We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1431d36 commit 91051efCopy full SHA for 91051ef
extra/decimal_printer.py
@@ -50,9 +50,14 @@ def decimal32_summary(valobj, internal_dict):
50
if significand == 0:
51
result = "0.0e+0"
52
else:
53
+ # TODO(mborland): Make sure we preserve the amount of precision
54
n_digits = len(str(abs(significand)))
- normalized = significand / (10 ** (n_digits - 1))
55
- total_exp = exp + n_digits - 1
+ if n_digits > 1:
56
+ normalized = significand / (10 ** (n_digits - 1))
57
+ total_exp = exp + n_digits - 1
58
+ else:
59
+ normalized = significand
60
+ total_exp = exp
61
result = f"{'-' if not sign else ''}{normalized}e{total_exp:+}"
62
63
return result
0 commit comments