Merge pull request #902 from reactormonk/float_toString
use `.f` instead of `.16e` for floats
This commit is contained in:
commit
bb8b9da391
1 changed files with 4 additions and 2 deletions
|
|
@ -252,8 +252,10 @@ proc nimIntToStr(x: int): string {.compilerRtl.} =
|
||||||
|
|
||||||
proc nimFloatToStr(x: float): string {.compilerproc.} =
|
proc nimFloatToStr(x: float): string {.compilerproc.} =
|
||||||
var buf: array [0..59, char]
|
var buf: array [0..59, char]
|
||||||
c_sprintf(buf, "%#.16e", x)
|
c_sprintf(buf, "%#.f", x)
|
||||||
return $buf
|
result = $buf
|
||||||
|
if result[len(result)-1] == '.':
|
||||||
|
result.add("0")
|
||||||
|
|
||||||
proc nimInt64ToStr(x: int64): string {.compilerRtl.} =
|
proc nimInt64ToStr(x: int64): string {.compilerRtl.} =
|
||||||
result = newString(sizeof(x)*4)
|
result = newString(sizeof(x)*4)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue