[Bug c/47146] Floating point to integer conversions
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Jan 1 18:21:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47146
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-01-01 18:21:01 UTC ---
(In reply to comment #0)
> Casting and rounding seems to be a problem.
Please be more specific.
Do you understand how floating point works?
Do you know that "0.39 * 100" has type double, not float, so has more precision
(and a different value) than "(float)0.39 * 100" ?
If you use doubles, or consistently use floats (not a mix of floats and
doubles) then you get consistent results
More information about the Gcc-bugs
mailing list