[Bug fortran/44448] 32-bit gfortran.dg/atan2_1.f90 fails on Solaris 1[01]/x86 at -O0

fxcoudert at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Jun 16 21:30:00 GMT 2010



------- Comment #5 from fxcoudert at gcc dot gnu dot org  2010-06-16 21:30 -------
This makes no sense at all. Rainer, I'm really sorry if it seems that I'm
shooting questions a bit at random, but I have a hard time imagining how to
narrow it down.

Can you try the following equivalent C code (at -O0):


#include <math.h>
#include <stdio.h>

int main (void)
{
  int i;
  float x;
  double y;

  for (i = 1; i <= 10; i++)
  {
    x = __builtin_atan2f (1.f, (float) i / 10.f)
        - __builtin_atan2f (1.f, (float) i / 10.f);
    printf ("%g\n", x);

    x = atan2f (1.f, (float) i / 10.f)
        - atan2f (1.f, (float) i / 10.f);
    printf ("%g\n", x);

    y = __builtin_atan2 (1., (double) i / 10.)
        - __builtin_atan2 (1., (double) i / 10.);
    printf ("%lg\n", y);

    y = atan2 (1., (double) i / 10.)
        - atan2 (1., (double) i / 10.);
    printf ("%lg\n", y);
  }

  return 0;
}


Right now, the only thing I can see make sense is numerically instability in
the libm. Also, how are atan2f and atan2 defined in the system's math.h header?
Do they have simple prototypes? Are they actually macros?


-- 


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



More information about the Gcc-bugs mailing list