New issue
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
astropy.units.isclose broken in astropy 5.1 #13280
Comments
Thanks for reporting this. But has this ever worked? The discrepancy is because the defaults are different. I went through the actual = 0.0
desired = 2.220446049250313e-16
rtol = 1e-05
atol = 0.0 Meanwhile, this is the numpy default: So, you should do this instead when comparing zeroes: >>> u.isclose(0 * u.m, np.finfo(np.float64).eps * u.m, atol=1e-8 * u.m)
True I am not sure if the different default setting was by design, and outdated default (maybe numpy changed it upstream?), or a bug. If we decided to patch this behavior, should add a test with the use case stated above. |
I got a broken test in the CI of ctapipe after it started using 5.1 |
All this code that I mentioned has not been touched for at least 2 years. What version of astropy did you upgrade from? For now, explicitly setting |
The previous runs were using 5.0.4, strange |
What was the value of Fun fact: I came across this: |
Mmh. I am confused now. I cannot reproduce locally. Test passes with 5.1 locally... So it has to be something else, sorry for the fuzz. Still confusing why it worked before. |
Hi humans 👋 - this issue was labeled as Close? approximately 6 hours ago. If you think this issue should not be closed, a maintainer should remove the Close? label - otherwise, I will close this issue in 7 days. If you believe I commented on this issue incorrectly, please report this here |
@maxnoe - the reasoning behind the different default for Anyway, I'll close this since it doesn't seem there was a change in behaviour from the astropy side... |
Description
astropy.units.isclose
returns false for values within floating point precisionsExpected behavior
astropy.units.isclose
returns true for values within floating point precisionsActual behavior
astropy.units.isclose
returns false for values within floating point precisionsSteps to Reproduce
System Details
The text was updated successfully, but these errors were encountered: