bug in nextafter{f,} for x86

Richard Henderson rth@twiddle.net
Wed Nov 26 03:02:00 GMT 2003


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~



More information about the Libc-alpha mailing list