This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/29597] log expression returns different results when casting
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Oct 2006 06:39:21 -0000
- Subject: [Bug c++/29597] log expression returns different results when casting
- References: <bug-29597-13470@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from bangerth at dealii dot org 2006-10-26 06:39 -------
To be more concrete: (int)(expression) rounds down. So if your quotient
of logarithms happens to be computed to 5.999999999999999, then you
will get a result of 5 after casting to int. You should round results,
not just cast them.
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29597