https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110749

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Your program is using the default precision for printing a double: 6
significant figures.

101.92249999999999943 with 6 digits of precision is 101.922 (because (24 rounds
to 2).

101.92249999999999943 with 7 digits of precision is 101.9225 (because 49 rounds
to 5).

If you use std::setprecision(7) << std::abs(value) you will get 101.9225:

000000000090.8425
000000000101.9225

If you use std::setprecision(17) you will get the same values as GDB shows:

090.842500000000001
000000000101.9225

If you use std::setprecision(18) you'll see that Andreas is correct:

090.8425000000000011
0101.922499999999999


This is not a GCC bug, this is just how floating-point numbers work.

Reply via email to