1 /**
2  * This file has no copyright assigned and is placed in the Public Domain.
3  * This file is part of the mingw-w64 runtime package.
4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5  */
6 #include <math.h>
7 
8 float
nextafterf(float x,float y)9 nextafterf (float x, float y)
10 {
11   union
12   {
13     float f;
14     unsigned int i;
15   } u;
16   if (isnan (y) || isnan (x))
17     return x + y;
18   if (x == y )
19      /* nextafter (0.0, -O.0) should return -0.0.  */
20      return y;
21   u.f = x;
22   if (x == 0.0F)
23     {
24       u.i = 1;
25       return y > 0.0F ? u.f : -u.f;
26     }
27   if (((x > 0.0F) ^ (y > x)) == 0)
28     u.i++;
29   else
30     u.i--;
31   return u.f;
32 }
33