Fixes $(0.0/0.0) giving -nan on some systems.
Squashed commit of the following:
commit c7fc086b663f4d4003ccd5831a0ca508cf9badc7
Author: Dominik Picheta <dominikpicheta@gmail.com>
Date: Sat Sep 17 21:09:48 2016 +0200
Another attempt at fix.
commit 67b7fb67cda08d945e480a6a01fb0fee797add00
Author: Dominik Picheta <dominikpicheta@gmail.com>
Date: Sat Sep 17 20:47:41 2016 +0200
Fixes $(0.0/0.0) giving `-nan` on some systems.
This commit is contained in:
parent
93160547a9
commit
b56595ae26
1 changed files with 1 additions and 1 deletions
|
|
@ -292,7 +292,7 @@ proc nimFloatToStr(f: float): string {.compilerproc.} =
|
||||||
buf[n+2] = '\0'
|
buf[n+2] = '\0'
|
||||||
# On Windows nice numbers like '1.#INF', '-1.#INF' or '1.#NAN' are produced.
|
# On Windows nice numbers like '1.#INF', '-1.#INF' or '1.#NAN' are produced.
|
||||||
# We want to get rid of these here:
|
# We want to get rid of these here:
|
||||||
if buf[n-1] == 'N':
|
if buf[n-1] in {'n', 'N'}:
|
||||||
result = "nan"
|
result = "nan"
|
||||||
elif buf[n-1] == 'F':
|
elif buf[n-1] == 'F':
|
||||||
if buf[0] == '-':
|
if buf[0] == '-':
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue