| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -568,14 +568,15 @@ def test_Normalize(): | |
| # Don't lose precision on longdoubles (float128 on Linux): | ||
| # for array inputs... | ||
| vals = np.array([1.2345678901, 9.8765432109], dtype=np.longdouble) | ||
| norm = mcolors.Normalize(vals.min(), vals.max()) | ||
| assert_array_equal(np.asarray(norm(vals)), [0, 1]) | ||
| norm = mcolors.Normalize(vals[0], vals[1]) | ||
| assert norm(vals).dtype == np.longdouble | ||
| assert_array_equal(norm(vals), [0, 1]) | ||
| # and for scalar ones. | ||
| eps = np.finfo(np.longdouble).resolution | ||
| norm = plt.Normalize(1, 1 + 100 * eps) | ||
| # This returns exactly 0.5 when longdouble is extended precision (80-bit), | ||
| # but only a value close to it when it is quadruple precision (128-bit). | ||
| assert 0 < norm(1 + 50 * eps) < 1 | ||
| np.testing.assert_array_almost_equal_nulp(norm(1 + 50 * eps), 0.5) | ||
|
Comment thread
Comment on lines
577
to
+579
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThis seems to be a bit too strict now, as it is failing on aarch64, ppc64le, and s390x, where the result is 0.50096339. Also, on my 64-bit AMD system, which is apparently using np.float128 for np.longdouble (though I don't know if that means 80-bit internally), it seems to return 0.5 exactly, which seems the opposite of the comment.
Sorry, something went wrong.
All reactions
|
||
|
|
||
|
|
||
| def test_FuncNorm(): | ||
| Expand Down | ||
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.