------- Comment #1 from burnus at gcc dot gnu dot org  2007-06-15 12:54 -------
Uros writes:
----------------------------------------------------------------
I have fond the problem in following lines:

! --- Process new position
     S = S + DS
     IF ( FLOAT(NNP/NP).EQ.FLOAT(NNP)/XNP ) THEN          <<<< here
        NN = NNP/NP

The problem is one ULP of the rcpss insn (+NR step), illustrated by
the following testcase:

--cut here--
float recip(float a)
{
 float xx = 1.0f/a;
 printf("%a\n", xx);

 return xx;
}

int NNP = 1;
int NP = 1;
float XNP = 1.0f;

int main()
{
 float a, b;
 int c;

 a = (float)(NNP/NP);
 b = (float)(NNP)*recip(XNP);

 printf("%a %a %i\n", a, b, a == b);

 return 0;
}
--cut here--

gcc -O2 -msse2 -mfpmath=sse -ffast-math equal.c
./a.out
0x1p+0
0x1p+0 0x1p+0 1

gcc -O2 -msse2 -mfpmath=sse -ffast-math -mrecip equal.c
./a.out
0x1.fffffep-1
0x1p+0 0x1.fffffep-1 0

Actually, the recip pass is OK, it is just a precision problem. This
is why -mrecip should stay separate option, not included in
-ffast-math...


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |WORKSFORME


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32352

Reply via email to