summary refs log tree commit diff stats
path: root/lib/std/formatfloat.nim
diff options
context:
space:
mode:
authorBung <crc32@qq.com>2022-12-01 20:34:00 +0800
committerGitHub <noreply@github.com>2022-12-01 13:34:00 +0100
commit658b28dc5707601b39d9aad4b6bf79a9afff1e92 (patch)
treeb8e10d4d1f2666c45c3b1dec23e7c03d5ba23be9 /lib/std/formatfloat.nim
parenta70d3abd37819e7562f80f0c808788c3f5c62c55 (diff)
downloadNim-658b28dc5707601b39d9aad4b6bf79a9afff1e92.tar.gz
tyInt tyUint fit target int bit width (#20829)
Diffstat (limited to 'lib/std/formatfloat.nim')
-rw-r--r--lib/std/formatfloat.nim6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/std/formatfloat.nim b/lib/std/formatfloat.nim
index 2850f7021..01b88d813 100644
--- a/lib/std/formatfloat.nim
+++ b/lib/std/formatfloat.nim
@@ -28,11 +28,11 @@ proc writeFloatToBufferRoundtrip*(buf: var array[65, char]; value: BiggestFloat)
   ##
   ## returns the amount of bytes written to `buf` not counting the
   ## terminating '\0' character.
-  result = toChars(buf, value, forceTrailingDotZero=true)
+  result = toChars(buf, value, forceTrailingDotZero=true).int
   buf[result] = '\0'
 
 proc writeFloatToBufferRoundtrip*(buf: var array[65, char]; value: float32): int =
-  result = float32ToChars(buf, value, forceTrailingDotZero=true)
+  result = float32ToChars(buf, value, forceTrailingDotZero=true).int
   buf[result] = '\0'
 
 proc c_sprintf(buf, frmt: cstring): cint {.header: "<stdio.h>",
@@ -49,7 +49,7 @@ proc writeFloatToBufferSprintf*(buf: var array[65, char]; value: BiggestFloat):
   ##
   ## returns the amount of bytes written to `buf` not counting the
   ## terminating '\0' character.
-  var n: int = c_sprintf(cast[cstring](addr buf), "%.16g", value)
+  var n = c_sprintf(cast[cstring](addr buf), "%.16g", value).int
   var hasDot = false
   for i in 0..n-1:
     if buf[i] == ',':