More human readable $(float)

The output matches that of Python (eg 1e100, not 1.0e100), but also
reflects locale (assuming it was set using setlocale() before).
This commit is contained in:
katlogic 2014-06-15 01:49:14 +02:00
commit cea2a9087d
3 changed files with 16 additions and 7 deletions

View file

@ -17,12 +17,12 @@ proc reprFloat(x: float): string {.compilerproc.} = return $x
proc reprPointer(x: pointer): string {.compilerproc.} =
var buf: array [0..59, char]
c_sprintf(buf, "%p", x)
discard c_sprintf(buf, "%p", x)
return $buf
proc `$`(x: uint64): string =
var buf: array [0..59, char]
c_sprintf(buf, "%llu", x)
discard c_sprintf(buf, "%llu", x)
return $buf
proc reprStrAux(result: var string, s: string) =