Recently, sometimes (rarely) when we export data from our application, the export log contains float values that look like “-1.#J”. I haven’t been able to reproduce it so I don’t know what the float looks like in binary, or how Visual Studio displays it.
I tried looking at the source code for printf, but didn’t find anything (not 100% sure I looked at the right version though…).
I’ve tried googling but google throws away any #, it seems. And I can’t find any lists of float errors.
It can be either negative infinity or NaN (not a number). Due to the formatting on the field printf does not differentiate between them.
I tried the following code in Visual Studio 2008:
which results in the following output:
removing the .3 formatting specifier gives:
so it’s clear 0/0 gives NaN and -1/0 gives negative infinity (NaN, -inf and +inf are the only “erroneous” floating point numbers, if I recall correctly)