diff options
| author | Sebastian Berg <sebastian@sipsolutions.net> | 2021-11-09 16:16:48 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-09 16:16:48 -0600 |
| commit | a0d86e298b18f6c1bc13d2ed032ac7fd9d67e592 (patch) | |
| tree | 1d4ceae313113e10ce957c3a2a0c95009b3f31e9 /numpy/lib/tests/test_function_base.py | |
| parent | e1239e7152c87fa97266f62e107d383905e6006c (diff) | |
| parent | 53e3df3c99a26791cc07e2ea1570e87643fdf7e0 (diff) | |
| download | numpy-a0d86e298b18f6c1bc13d2ed032ac7fd9d67e592.tar.gz | |
Merge pull request #20331 from bzah/fix/quantile-default-lerp-method
MAINT: Update quantile default lerp method
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
| -rw-r--r-- | numpy/lib/tests/test_function_base.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index d5fa012f1..1c274afae 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -3356,6 +3356,14 @@ class TestPercentile: class TestQuantile: # most of this is already tested by TestPercentile + def test_max_ulp(self): + x = [0.0, 0.2, 0.4] + a = np.quantile(x, 0.45) + # The default linear method would result in 0 + 0.2 * (0.45/2) = 0.18. + # 0.18 is not exactly representable and the formula leads to a 1 ULP + # different result. Ensure it is this exact within 1 ULP, see gh-20331. + np.testing.assert_array_max_ulp(a, 0.18, maxulp=1) + def test_basic(self): x = np.arange(8) * 0.5 assert_equal(np.quantile(x, 0), 0.) |
