diff options
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/rodutils.nim | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rodutils.nim b/compiler/rodutils.nim index 1352afadb..3a90a207c 100644 --- a/compiler/rodutils.nim +++ b/compiler/rodutils.nim @@ -21,9 +21,9 @@ proc toStrMaxPrecision*(f: BiggestFloat, literalPostfix = ""): string = if f > 0.0: result = "INF" else: result = "-INF" else: - result = newString(80) - let newLen = c_snprintf(result[0].addr, 81, "%#.16e" & literalPostfix, f) - result.setLen(newLen) + var buf: array[0..80, char] + let newLen = c_snprintf(buf.cstring, buf.len.uint, "%#.16e%s", f, literalPostfix.cstring) + result = $buf.cstring proc encodeStr*(s: string, result: var string) = for i in countup(0, len(s) - 1): |