From ffa9a7405fe55f91d3816d3cf4b3b1b82ede21ff Mon Sep 17 00:00:00 2001 From: Miran Date: Tue, 5 Nov 2019 10:31:23 +0100 Subject: fix #8242, fix #12586: fix 'formatFloat' with 'precision = 0' (#12592) * fix #8242, fix #12586: fix 'formatFloat' with 'precision = 0' 'formatFloat' with 'precision = 0' now gives the same result (a number without a decimal point) in all backends. This is compatible with Python's formatters, too. * fix failing tests * add changelog entry * add version switch --- tests/destructor/tnewruntime_strutils.nim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/destructor/tnewruntime_strutils.nim b/tests/destructor/tnewruntime_strutils.nim index c77177f58..dd190a1b6 100644 --- a/tests/destructor/tnewruntime_strutils.nim +++ b/tests/destructor/tnewruntime_strutils.nim @@ -14,8 +14,7 @@ proc retTuple(): (seq[int], int) = proc nonStaticTests = doAssert formatBiggestFloat(1234.567, ffDecimal, -1) == "1234.567000" - when not defined(js): - doAssert formatBiggestFloat(1234.567, ffDecimal, 0) == "1235." # <=== bug 8242 + doAssert formatBiggestFloat(1234.567, ffDecimal, 0) == "1235" # bugs 8242, 12586 doAssert formatBiggestFloat(1234.567, ffDecimal, 1) == "1234.6" doAssert formatBiggestFloat(0.00000000001, ffDecimal, 11) == "0.00000000001" doAssert formatBiggestFloat(0.00000000001, ffScientific, 1, ',') in -- cgit 1.4.1-2-gfad0