[Bug c++/57034] ternary operator with float infinity in O0
christopher.hite at jpmorgan dot com
gcc-bugzilla@gcc.gnu.org
Tue Apr 23 17:26:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57034
--- Comment #6 from Christopher Hite <christopher.hite at jpmorgan dot com> 2013-04-23 17:26:26 UTC ---
Good, I was a big worried I couldn't convert ints to floats unless the int was
safely mappable. It rounds which is what I'd expect.
I now think z5 is safe, since int32_t(float(MAX)) wouldn't be evaluated.
const float fMAX=std::numeric_limits<int32_t>::max();
Any (positive) float less than fMax, must be representable in int32_t, though
z5 will never equal MAX-1 or MAX-2....
Do you agree?
z5 is definately clearer code than playing with fetestexcept(). I'd guess it's
also faster.
More information about the Gcc-bugs
mailing list