Make sure comparisons are working right
(self)
| 309 | f"{finite_f64[bad_index]:g} != {a_manual[bad_index]:g}") |
| 310 | |
| 311 | def test_half_ordering(self): |
| 312 | """Make sure comparisons are working right""" |
| 313 | nonan_f16, _, _ = self._create_arrays_nonan() |
| 314 | |
| 315 | # All non-NaN float16 values in reverse order |
| 316 | a = nonan_f16[::-1].copy() |
| 317 | |
| 318 | # 32-bit float copy |
| 319 | b = np.array(a, dtype=float32) |
| 320 | |
| 321 | # Should sort the same |
| 322 | a.sort() |
| 323 | b.sort() |
| 324 | assert_equal(a, b) |
| 325 | |
| 326 | # Comparisons should work |
| 327 | assert_((a[:-1] <= a[1:]).all()) |
| 328 | assert_(not (a[:-1] > a[1:]).any()) |
| 329 | assert_((a[1:] >= a[:-1]).all()) |
| 330 | assert_(not (a[1:] < a[:-1]).any()) |
| 331 | # All != except for +/-0 |
| 332 | assert_equal(np.nonzero(a[:-1] < a[1:])[0].size, a.size - 2) |
| 333 | assert_equal(np.nonzero(a[1:] > a[:-1])[0].size, a.size - 2) |
| 334 | |
| 335 | def test_half_funcs(self): |
| 336 | """Test the various ArrFuncs""" |
nothing calls this directly
no test coverage detected