File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed
Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change 99from generate_string import generate_string
1010
1111def decode_decimal_fast32 (significand , exp , sign ):
12- return generate_string (significand , exp , sign )
1312
13+ # See values of non-finite masks in decimal_fast32_t.hpp
14+ if significand >= 536870912 :
15+ isnan = False
16+
17+ if significand == 536870912 :
18+ result = "-INF" if sign else "INF"
19+ elif significand >= 3758096384 :
20+ result = "-SNAN" if sign else "SNAN"
21+ significand ^= 3758096384
22+ isnan = True
23+ elif significand >= 1610612736 :
24+ result = "-QNAN" if sign else "QNAN"
25+ significand ^= 1610612736
26+ isnan = True
27+ else :
28+ raise ValueError ("Unknown Finite Value" )
29+
30+ if isnan and significand > 0 :
31+ result += '(' + str (significand ) + ')'
32+
33+ else :
34+ exp -= 101 # Bias value
35+ result = generate_string (significand , exp , sign )
36+
37+ return result
You can’t perform that action at this time.
0 commit comments