[Bug target/61563] better 387 code for float x == (int)x

joseph at codesourcery dot com gcc-bugzilla@gcc.gnu.org
Thu Jun 19 16:22:00 GMT 2014


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

--- Comment #1 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
Note that it's only for certain pairs of floating-point and integer type 
that the rounding mode doesn't matter.  It's true for float and int, 
because the precision of float is small enough, compared to that of int, 
that values that are within range for int when converted rounding towards 
zero, but that might overflow and so cause a spurious "invalid" exception 
if converted in another rounding mode, can't be represented in float.  
But it's not true for double and int, for example (though maybe more cases 
are allowed by -fno-trapping-math).



More information about the Gcc-bugs mailing list