http://www.cplusplus.com/reference/ios/scientific/

says

"Finally, this notation always includes an exponential part consisting on the letter e followed by an optional sign and three exponential digits."

However this is not what the latest compilers MSVC, GCC or Clang now do - they output 2 or 3 (or more?) as required.

They also always provide the sign of the exponent.

"Finally, this notation always includes an exponential part consisting on the letter e followed by an (possibly optional) sign and at least two exponential digits."

I believe that this minimum changed with at least C++14 Standard.

says

"Finally, this notation always includes an exponential part consisting on the letter e followed by an optional sign and three exponential digits."

However this is not what the latest compilers MSVC, GCC or Clang now do - they output 2 or 3 (or more?) as required.

They also always provide the sign of the exponent.

"Finally, this notation always includes an exponential part consisting on the letter e followed by an (possibly optional) sign and at least two exponential digits."

I believe that this minimum changed with at least C++14 Standard.

3 supports 999 digits. remember that 1.23 e2 is 123. e3 is 1230.

floating point double only supports about 15 decimal digits, so in sci notation anything over 15 is starting to be imprecise for doubles. you can go a lot higher if you have big numbers eg e100 where the last 85 digits are all zeros, or tiny numbers with leading zeros. Double supports about 300 +- for that, so 4 digits isnt needed until you go to > 64 bit formats.

floating point double only supports about 15 decimal digits, so in sci notation anything over 15 is starting to be imprecise for doubles. you can go a lot higher if you have big numbers eg e100 where the last 85 digits are all zeros, or tiny numbers with leading zeros. Double supports about 300 +- for that, so 4 digits isnt needed until you go to > 64 bit formats.

Last edited on

Registered users can post here. Sign in or register to post.