OSDN Git Service

Consolidate fmod() and remainder() source code.
[mingw/mingw-org-wsl.git] / mingwrt / mingwex / math / nextafterf.c
1 #include <math.h>
2
3 float
4 nextafterf (float x, float y)
5 {
6   union
7   {
8     float f;
9     unsigned int i;
10   } u;
11   if (isnan (y) || isnan (x))
12     return x + y;
13   if (x == y )
14      /* nextafter (0.0, -O.0) should return -0.0.  */
15      return y;
16   u.f = x;
17   if (x == 0.0F)
18     {
19       u.i = 1;
20       return y > 0.0F ? u.f : -u.f;
21     }
22   if (((x > 0.0F) ^ (y > x)) == 0)
23     u.i++;
24   else
25     u.i--;
26   return u.f;
27 }