fix unused variable warnings in new nextafter/nexttoward code
[musl] / src / math / nextafterf.c
1 #include "libm.h"
2
3 #define SIGN 0x80000000
4
5 float nextafterf(float x, float y)
6 {
7         union fshape ux, uy;
8         uint32_t ax, ay, e;
9
10         if (isnan(x) || isnan(y))
11                 return x + y;
12         ux.value = x;
13         uy.value = y;
14         if (ux.bits == uy.bits)
15                 return y;
16         ax = ux.bits & ~SIGN;
17         ay = uy.bits & ~SIGN;
18         if (ax == 0) {
19                 if (ay == 0)
20                         return y;
21                 ux.bits = (uy.bits & SIGN) | 1;
22         } else if (ax > ay || ((ux.bits ^ uy.bits) & SIGN))
23                 ux.bits--;
24         else
25                 ux.bits++;
26         e = ux.bits & 0x7f800000;
27         /* raise overflow if ux.value is infinite and x is finite */
28         if (e == 0x7f800000)
29                 return x + x;
30         /* raise underflow if ux.value is subnormal or zero */
31         if (e == 0) {
32                 volatile float z;
33                 z = x*x + ux.value*ux.value;
34         }
35         return ux.value;
36 }