Less stringent normalization test for float128.#7167
Less stringent normalization test for float128.#7167tacaswell merged 1 commit intomatplotlib:masterfrom
Conversation
| assert_equal(norm(1 + 50 * eps), .5) | ||
| # 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 |
There was a problem hiding this comment.
You could also use one of the "almost equal" asserts from numpy (or nose, or pytest)
There was a problem hiding this comment.
It's not almost equal (it's around 0.2% off).
There was a problem hiding this comment.
I don't understand your comment. The tests "assert_almost_equal" has a epsilon value. It is used exactly for that case where there are floating points error. You need to set the epsilon value yourself.
There was a problem hiding this comment.
Ah, I was thinking about the default of assert_allclose. Anyways, see the discussion starting at #7159 (comment): the point is that I'd rather let a FP expert confirm what is the tolerance that makes sense; without that the safest is just to check that the normalization is not trivial (does not map everything to 0 or 1).
…-precision TST: Less stringent normalization test for float128.
|
backported to v2.x as 2e12ac9 |
cf #7159. I decided to go the less stringent way.