We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6cd6875 commit 53e3df3Copy full SHA for 53e3df3
numpy/lib/tests/test_function_base.py
@@ -3356,6 +3356,14 @@ def test_nan_q(self):
3356
class TestQuantile:
3357
# most of this is already tested by TestPercentile
3358
3359
+ def test_max_ulp(self):
3360
+ x = [0.0, 0.2, 0.4]
3361
+ a = np.quantile(x, 0.45)
3362
+ # The default linear method would result in 0 + 0.2 * (0.45/2) = 0.18.
3363
+ # 0.18 is not exactly representable and the formula leads to a 1 ULP
3364
+ # different result. Ensure it is this exact within 1 ULP, see gh-20331.
3365
+ np.testing.assert_array_max_ulp(a, 0.18, maxulp=1)
3366
+
3367
def test_basic(self):
3368
x = np.arange(8) * 0.5
3369
assert_equal(np.quantile(x, 0), 0.)
0 commit comments