This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: libstdc++/9880: setprecision() strange behaviour
- From: bangerth at dealii dot org
- To: Alberto dot Ribon at cern dot ch, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org
- Date: 27 Feb 2003 17:43:11 -0000
- Subject: Re: libstdc++/9880: setprecision() strange behaviour
- Reply-to: bangerth at dealii dot org, Alberto dot Ribon at cern dot ch, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
Synopsis: setprecision() strange behaviour
State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Thu Feb 27 17:43:10 2003
State-Changed-Why:
Not a bug. Note that not every number with a simple
radix-10 representation can be represented exactly as a
finite precision floating point number. If you do
a floating point assignment, the compiler chooses the closest
representable floating point number. If you later output
it with only a small number of digits, the exact value
of the double gets rounded to what you "expext". If you
output all digits, you see the true value of the floating
point representation.
W.
PS: If you find a bug in egcs1.1, gcc2.95 and 3.2, as well
as Sun CC 6 and 7, there's a good chance it's just your
misunderstanding, not a bug in so many different compilers...
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9880