This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

bug in nextafter{f,} for x86


The following test case fails.

#include <math.h>
#include <float.h>
#include <stdlib.h>

int main()
{
  float i = INFINITY;
  float m = FLT_MAX;
  if (nextafterf(m, i) != i)
    abort ();
  return 0;
}

This is because 

        if(hy>=0x7f800000) return x+x;  /* overflow  */

does not in fact overflow on x86; it gets computed with
long double precision.


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]