FloatingPointMath and transformations
Vincent Lefevre
vincent+gcc@vinc17.org
Mon Jun 2 14:06:00 GMT 2014
I've looked at
https://gcc.gnu.org/wiki/FloatingPointMath
and there may be some mistakes or missing info.
First, it is said that x / C is replaced by x * (1.0 / C) when C is
a power of two. But this condition is not sufficient: if 1.0 / C
overflows, the transformation is incorrect. From some testing,
it seems that GCC detects the overflow case, so that it behaves
correctly. In this case I think that the wiki should say:
"When C is a power of two and 1.0 / C doesn't overflow."
It is also said that x / 1.0 and x / -1.0 are respectively replaced
by x and -x. But what about x * 1.0 and x * -1.0?
Ditto with -(a / b) -> a / -b and -(a / b) -> -a / b. Is there
anything similar with multiplication?
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
More information about the Gcc
mailing list