summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2014-04-09 00:06:18 +0200
committerAndreas Rumpf <rumpf_a@web.de>2014-04-09 00:06:18 +0200
commitbb8b9da3919447824472913561b2e127cccf16d1 (patch)
treef2465384e62358f59f8bf7ffde7174aa3a431e9d
parent3e25d5f24747c324a5a0f0deb555611166c96209 (diff)
parent33fcd112360c60078ae7ee4ddb93cbe9f44393bd (diff)
downloadNim-bb8b9da3919447824472913561b2e127cccf16d1.tar.gz
Merge pull request #902 from reactormonk/float_toString
use `.f` instead of `.16e` for floats
-rw-r--r--lib/system/sysstr.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/system/sysstr.nim b/lib/system/sysstr.nim
index 4244bae4c..eb9d2000b 100644
--- a/lib/system/sysstr.nim
+++ b/lib/system/sysstr.nim
@@ -252,8 +252,10 @@ proc nimIntToStr(x: int): string {.compilerRtl.} =
 
 proc nimFloatToStr(x: float): string {.compilerproc.} =
   var buf: array [0..59, char]
-  c_sprintf(buf, "%#.16e", x)
-  return $buf
+  c_sprintf(buf, "%#.f", x)
+  result = $buf
+  if result[len(result)-1] == '.':
+    result.add("0")
 
 proc nimInt64ToStr(x: int64): string {.compilerRtl.} =
   result = newString(sizeof(x)*4)