File tree Expand file tree Collapse file tree 4 files changed +10
-37
lines changed
Expand file tree Collapse file tree 4 files changed +10
-37
lines changed Original file line number Diff line number Diff line change 22# Distributed under the Boost Software License, Version 1.0.
33# https://www.boost.org/LICENSE_1_0.txt
44
5+ from generate_string import generate_string
6+
57def decode_decimal128 (bits ):
68
79 bits_high = bits >> 64
@@ -41,17 +43,6 @@ def decode_decimal128(bits):
4143
4244 exp -= 6176 # Bias Value
4345
44- if significand == 0 :
45- result = "0.0e+0"
46- else :
47- sig_str = str (significand )
48- n_digits = len (sig_str )
49- if n_digits == 1 :
50- normalized_str = sig_str
51- total_exp = exp
52- else :
53- normalized_str = sig_str [0 ] + '.' + sig_str [1 :]
54- total_exp = exp + n_digits - 1
55- result = f"{ '-' if sign else '' } { normalized_str } e{ total_exp :+} "
46+ result = generate_string (significand , exp , sign )
5647
5748 return result
Original file line number Diff line number Diff line change 22# Distributed under the Boost Software License, Version 1.0.
33# https://www.boost.org/LICENSE_1_0.txt
44
5+ from generate_string import generate_string
6+
57def decode_decimal32 (bits ):
68 sign = bits & 2147483648 != 0
79 isnan = False
@@ -37,17 +39,6 @@ def decode_decimal32(bits):
3739
3840 exp -= 101 # Bias Value
3941
40- if significand == 0 :
41- result = "0.0e+0"
42- else :
43- sig_str = str (significand )
44- n_digits = len (sig_str )
45- if n_digits == 1 :
46- normalized_str = sig_str
47- total_exp = exp
48- else :
49- normalized_str = sig_str [0 ] + '.' + sig_str [1 :]
50- total_exp = exp + n_digits - 1
51- result = f"{ '-' if sign else '' } { normalized_str } e{ total_exp :+} "
42+ result = generate_string (significand , exp , sign )
5243
5344 return result
Original file line number Diff line number Diff line change 22# Distributed under the Boost Software License, Version 1.0.
33# https://www.boost.org/LICENSE_1_0.txt
44
5+ from generate_string import generate_string
6+
57def decode_decimal64 (bits ):
68 sign = bits & 9223372036854775808 != 0
79 isnan = False
@@ -36,17 +38,6 @@ def decode_decimal64(bits):
3638
3739 exp -= 398 # Bias Value
3840
39- if significand == 0 :
40- result = "0.0e+0"
41- else :
42- sig_str = str (significand )
43- n_digits = len (sig_str )
44- if n_digits == 1 :
45- normalized_str = sig_str
46- total_exp = exp
47- else :
48- normalized_str = sig_str [0 ] + '.' + sig_str [1 :]
49- total_exp = exp + n_digits - 1
50- result = f"{ '-' if sign else '' } { normalized_str } e{ total_exp :+} "
41+ result = generate_string (significand , exp , sign )
5142
5243 return result
Original file line number Diff line number Diff line change 66
77def decode_fast_type (significand , exp , sign ):
88 return generate_string (significand , exp , sign )
9-
9+
You can’t perform that action at this time.
0 commit comments