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:
Dominik Picheta
2016-09-17 22:02:17 +02:00
parent 93160547a9
commit b56595ae26

View File

@@ -292,7 +292,7 @@ proc nimFloatToStr(f: float): string {.compilerproc.} =
buf[n+2] = '\0'
# On Windows nice numbers like '1.#INF', '-1.#INF' or '1.#NAN' are produced.
# We want to get rid of these here:
if buf[n-1] == 'N':
if buf[n-1] in {'n', 'N'}:
result = "nan"
elif buf[n-1] == 'F':
if buf[0] == '-':