| 102 | } |
| 103 | |
| 104 | npy_half npy_half_nextafter(npy_half x, npy_half y) |
| 105 | { |
| 106 | npy_half ret; |
| 107 | |
| 108 | if (npy_half_isnan(x) || npy_half_isnan(y)) { |
| 109 | ret = NPY_HALF_NAN; |
| 110 | } else if (npy_half_eq_nonan(x, y)) { |
| 111 | ret = x; |
| 112 | } else if (npy_half_iszero(x)) { |
| 113 | ret = (y&0x8000u) + 1; /* Smallest subnormal half */ |
| 114 | } else if (!(x&0x8000u)) { /* x > 0 */ |
| 115 | if ((npy_int16)x > (npy_int16)y) { /* x > y */ |
| 116 | ret = x-1; |
| 117 | } else { |
| 118 | ret = x+1; |
| 119 | } |
| 120 | } else { |
| 121 | if (!(y&0x8000u) || (x&0x7fffu) > (y&0x7fffu)) { /* x < y */ |
| 122 | ret = x-1; |
| 123 | } else { |
| 124 | ret = x+1; |
| 125 | } |
| 126 | } |
| 127 | #if NPY_HALF_GENERATE_OVERFLOW |
| 128 | if (npy_half_isinf(ret) && npy_half_isfinite(x)) { |
| 129 | npy_set_floatstatus_overflow(); |
| 130 | } |
| 131 | #endif |
| 132 | |
| 133 | return ret; |
| 134 | } |
| 135 | |
| 136 | int npy_half_eq_nonan(npy_half h1, npy_half h2) |
| 137 | { |
nothing calls this directly
no test coverage detected