Unreviewed patch

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Mon Feb 21 20:46:00 GMT 2005


Toon Moene wrote:
> To put it simply: If x is Inf and y is finite, what is the value of 
> nextafterf - and *why* ?

__FLT_MAX__ -- it's the representable number closest to x in the direction
towards y.  The clause about bit addition doesn't make sense here, so I think
we're safe to ignore it.  glibc agrees with this:

[tobi@marktplatz tests]$ cat inf.c
#include <math.h>
#include <stdio.h>

extern void abort();

int main()
{
  float f;

  f = nextafterf (1./0., 1.);
  if (f != __FLT_MAX__)
    puts ("NO");
  return 0;
}
[tobi@marktplatz tests]$ gcc inf.c -lm
[tobi@marktplatz tests]$ ./a.out
[tobi@marktplatz tests]$

- Tobi



More information about the Fortran mailing list