c++ - How to output a float neither in scientific, nor in fixed point notation in std::cout? -
#include <iostream> int main() { float test = 12535104400; std::cout << test; std::cin.get(); return 0; } //on msvc 2010 ouputs: 1.25351e+010
i output "12535104400" or in other words, human readable format has no leading zeros, outputs full value of number.
the particular number cannot accurately represented, example try following:
float v = 12535104400; cout.precision(0); cout << fixed << v << endl;
you'll see outputs: 12535104512
Comments
Post a Comment