This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: FP negation optimization
- From: Chris Lattner <sabre at nondot dot org>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Sun, 1 Feb 2004 17:06:16 -0600 (CST)
- Subject: Re: FP negation optimization
On Sun, 1 Feb 2004, Richard Henderson wrote:
> On Sun, Feb 01, 2004 at 02:50:31AM -0600, Chris Lattner wrote:
> > Is '-0.0 - X' always guaranteed to be the same as '-X' with IEEE math?
>
> No. X == +0.0 differs.
Are you sure? It seems to work for me, at least on X86:
void test(double X) {
printf("%f %f\n", -0.0 - X, -X);
}
int main() {
test(+0.0);
test(-0.0);
}
-Chris
--
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/