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 428a8b6 commit 2c2d170Copy full SHA for 2c2d170
extra/detail/generate_string.py
@@ -4,16 +4,18 @@
4
5
def generate_string(significand, exp, sign):
6
if significand == 0:
7
- result = "0.0e+0"
+ result = "0e+00"
8
else:
9
sig_str = str(significand)
10
n_digits = len(sig_str)
11
+
12
if n_digits == 1:
13
normalized_str = sig_str
14
total_exp = exp
15
16
normalized_str = sig_str[0] + '.' + sig_str[1:]
17
total_exp = exp + n_digits - 1
- result = f"{'-' if sign else ''}{normalized_str}e{total_exp:+}"
18
19
+ result = f"{'-' if sign else ''}{normalized_str}e{total_exp:+03d}"
20
21
return result
0 commit comments