Is there anyway to get a double type variable to print in scientific notation? My problem is to print some values to a file, but I end up with BIG values that would make MUCH more sense if I printed them in scientific notation.
Printable View
Is there anyway to get a double type variable to print in scientific notation? My problem is to print some values to a file, but I end up with BIG values that would make MUCH more sense if I printed them in scientific notation.
I think I solved the scientific notation problem, (the values were printed to a file, so I looked up fprintf) but one of my values is
-1.#QNAN
any idea why?
NAN is Not A Number
Undefined floating point results (eg. divide by 0) result in either a quiet NAN (QNAN) or a signalling NAN. A signalling NAN would have halted your program.
Any operation on a NAN results in a NAN, so it doesn't go away just like that.
Basically, you've got a math problem - either in the calculation, or because you're providing an uninitialised float as input.