When I use this:
printf("%e", 2000.0);
I get output 2.000000e+003
which is correct but very ugly. I then tried like this:
printf("%.1e", 2000.0);
Which outputs 2.0e+003
which is far better. The question is how to remove the 2 padding zeroes in the exponent so that the output is 2.0e+3
. Is there a specific printf
specifier for that or do I have to write a function manually that analyzes the floating point number and prints it the way I want (I'd hate to have to do that)?