@name Comparison with no guarantee of NaN behavior @{
| 170 | /// @name Comparison with no guarantee of NaN behavior |
| 171 | /// @{ |
| 172 | constexpr bool Less(Half r) const |
| 173 | { |
| 174 | uint_fast16_t a = static_cast<uint_fast16_t>(bits_), |
| 175 | b = static_cast<uint_fast16_t>(r.bits_); |
| 176 | bool sign_a = (a & 0x8000u) == 0x8000u; |
| 177 | bool sign_b = (b & 0x8000u) == 0x8000u; |
| 178 | // if both `a` and `b` have same sign |
| 179 | // Test if `a` > `b` when `a` has the sign |
| 180 | // or `a` < `b` when is not. |
| 181 | // And make sure they are not equal to each other |
| 182 | // in case of both are equal to +-0 |
| 183 | // else |
| 184 | // Test if `a` has the sign. |
| 185 | // and `a` != -0.0 and `b` != 0.0 |
| 186 | return (sign_a == sign_b) ? (sign_a ^ (a < b)) && (a != b) |
| 187 | : sign_a && ((a | b) != 0x8000u); |
| 188 | } |
| 189 | constexpr bool LessEqual(Half r) const |
| 190 | { |
| 191 | uint_fast16_t a = static_cast<uint_fast16_t>(bits_), |