@@ -24,20 +24,20 @@ def round_ndarray(
24
24
bias = fi .expBias
25
25
26
26
is_negative = np .signbit (v ) & fi .is_signed
27
- vpos = np .where (is_negative , - v , v )
27
+ absv = np .where (is_negative , - v , v )
28
28
29
29
nonzerofinite_mask = ~ (np .isnan (v ) | np .isinf (v ) | (v == 0 ))
30
30
31
31
# Place 1.0 where nonzerofinite_mask is False
32
- vpos_safe = np .where (nonzerofinite_mask , vpos , 1.0 )
32
+ absv_masked = np .where (nonzerofinite_mask , absv , 1.0 )
33
33
34
- expval = np .floor (np .log2 (vpos_safe )).astype (int )
34
+ expval = np .floor (np .log2 (absv_masked )).astype (int )
35
35
36
36
if fi .has_subnormals :
37
37
expval = np .maximum (expval , 1 - bias )
38
38
39
39
expval = expval - p + 1
40
- fsignificand = np .ldexp (vpos_safe , - expval )
40
+ fsignificand = np .ldexp (absv_masked , - expval )
41
41
42
42
isignificand = np .floor (fsignificand ).astype (np .int64 )
43
43
delta = fsignificand - isignificand
@@ -69,7 +69,7 @@ def round_ndarray(
69
69
expval += round_up & (isignificand == 1 )
70
70
isignificand = np .where (round_up , 1 , isignificand )
71
71
72
- result = np .where (nonzerofinite_mask , isignificand * (2.0 ** expval ), vpos )
72
+ result = np .where (nonzerofinite_mask , isignificand * (2.0 ** expval ), absv )
73
73
74
74
amax = np .where (is_negative , - fi .min , fi .max )
75
75
0 commit comments