diff options
author | skilchen <skilchen@users.noreply.github.com> | 2018-10-16 09:19:53 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-10-16 09:19:53 +0200 |
commit | f04c93b5dd1ee5e185f6849ad8116d08a687026d (patch) | |
tree | bb82126cc90058c72602ce40b2df60f0f514d453 /lib/pure | |
parent | 0c04da6f2644f97ff86d541e0c95dd92c7fb7753 (diff) | |
download | Nim-f04c93b5dd1ee5e185f6849ad8116d08a687026d.tar.gz |
math.round is not needed in strutils (#9383)
Diffstat (limited to 'lib/pure')
-rw-r--r-- | lib/pure/strutils.nim | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/pure/strutils.nim b/lib/pure/strutils.nim index 356604f42..5e36fd282 100644 --- a/lib/pure/strutils.nim +++ b/lib/pure/strutils.nim @@ -14,7 +14,7 @@ ## <backends.html#the-javascript-target>`_. import parseutils -from math import pow, round, floor, log10 +from math import pow, floor, log10 from algorithm import reverse when defined(nimVmExportFixed): @@ -2141,14 +2141,13 @@ proc formatEng*(f: BiggestFloat, result = significand.formatBiggestFloat(ffDecimal, precision, decimalSep='.') else: # Find the best exponent that's a multiple of 3 - fexponent = round(floor(log10(absolute))) - fexponent = 3.0 * round(floor(fexponent / 3.0)) + fexponent = floor(log10(absolute)) + fexponent = 3.0 * floor(fexponent / 3.0) # Adjust the significand for the new exponent significand /= pow(10.0, fexponent) - # Round the significand and check whether it has affected + # Adjust the significand and check whether it has affected # the exponent - significand = round(significand, precision) absolute = abs(significand) if absolute >= 1000.0: significand *= 0.001 |