Controlling precision after E in sci notation

This is a discussion on Controlling precision after E in sci notation within the C++ Programming forums, part of the General Programming Boards category; Hi,
I'm trying to print a number but it's printing like this:
1.0000e+000
but I want to only show two ...

Controlling precision after E in sci notation

Hi,

I'm trying to print a number but it's printing like this:
1.0000e+000
but I want to only show two 0's after the e+, do you know of any manipulators or something I could use to restrict the numebr of digits?

cplusplus.com states that three is the number of digits following the e, and the number of digits following the e shall be three. I can't find that language in the standard, but I also can't find anything that suggests it can be changed.

Admittedly, this doesn't handle NaN's very well, but you can do what you want with those. You may also want to reset some of the flags before going back to where you were. If you only plan on using four digits after the decimal point, you can probably get away with using floats instead of doubles.