Natural speed please
It appears someone decided that if you get an +-NAN or +-INFINITY they should throw an exception if one sends it to an printf statement.
I don't know the whys and wherefores of such an idea, it is causing some problems with an application I am writing. What I am use to is +INF -INF and +NAN -NAN being printed instead of exceptions.
These are valid floating point numbers, I am not quite getting why one should throw an exception.
Not all of such things happen inside the computer that is reading the data.
As said I don't get why it does this. However I need a way to get around this behavior so I can SEE the +-INF and +-NAN numbers.
Suggestions? Do I have to have exception handling on all floating point numbers using sprintf for formating?
Is there a way to get the sprintf function to behave like most and just print the +-INF/+-NAN...instead?
For me it's perfectly VALID data as I said (something else is generating it), so I just want to see that it is +-INF/+-NAN...and not throw a fit.
Before i read this one, the answer is simple:
I think even the fist instruction on the x86 will throw that. And the easiest way to get the number out is to fist then do multiplication by 10^n where n is the number of digits you want to handle, then fistp.
The problem is, the FPU can't handle infinity, and you can't do math on NaN because it's Not a Number (NaN). The CLIB expects YOU to check your work, that way it can focus on being speedy. Why build in slow checking if most of the time people aren't going to be printing back out use input? That's the programmer's job. Notice they don't check strings?