diff options
Diffstat (limited to 'winsup/mingw/mingwex/math/nextafterf.c')
-rw-r--r-- | winsup/mingw/mingwex/math/nextafterf.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/winsup/mingw/mingwex/math/nextafterf.c b/winsup/mingw/mingwex/math/nextafterf.c new file mode 100644 index 000000000..ac1fbee26 --- /dev/null +++ b/winsup/mingw/mingwex/math/nextafterf.c @@ -0,0 +1,29 @@ +#include <math.h> + +float +nextafterf (float x, float y) +{ + union + { + float f; + unsigned int i; + } u; + if (isnan (y) || isnan (x)) + return x + y; + if (x == y ) + return x; + u.f = x; + if (u.i == 0u) + { + if (y > 0.0F) + u.i = 1; + else + u.i = 0x80000001; + return u.f; + } + if (((x > 0.0F) ^ (y > x)) == 0) + u.i++; + else + u.i--; + return u.f; +} |