This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
fabs(-0.0) and soft-float
- From: Aldy Hernandez <aldyh at redhat dot com>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 2 Oct 2002 19:39:16 -0700
- Subject: fabs(-0.0) and soft-float
Hi guys.
I'm working on some soft-float patches for glibc which surfaced an
interesting problem.
Assume x = -0.0. For x = fabs(x), gcc will fold this into:
if (x >= 0)
x = x;
else
x = -x;
The relationship "-0.0 >= 0.0" is true. So fabs(-0.0) will end up
returning -0.0 and not 0.0 like it should.
I've confirmed that compiling with -fno-builtin fixes my problem.
Should we have gcc fold fabs() like this:?
if (x > 0)
x = x;
else
x = -x;
Ideas?
Aldy