-
Notifications
You must be signed in to change notification settings - Fork 40
FLOAT_CMP isn't powerful enough to handle whitespace that is added in fixed-width printing of floats #92
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
Comments
I could change the NumPy printing. First setup with: >>> import numpy
>>> old_floatmode = np.get_printoptions()['floatmode']
>>> np.set_printoptions(floatmode='fixed') and then teardown with: >>> np.set_printoptions(floatmode=old_floatmode) I'll have to mull over whether that's a better workaround. |
ideally |
I guess it's technically out of the scope of Anyway, I decided that being able to do proper float comparisons is more desirable than using ellipsis markers, so I added (hidden) |
yes, thus I think ideally |
I just hit this very same problem over at astropy/astropy#10511 . Glad I am not going crazy. I also resorted to manually setting numpy print options, which isn't pretty in the user example. |
See title. Here's a minimal example with
ndarray
, where I vary the least significant digit of the element the first row:The second test passes with FLOAT_CMP because the change is well under the relative tolerance.
The third test fails with:
This failure isn't because of exceeding the tolerance, but rather because of the space between "7" and "]". (I'm hitting this issue with a
SkyCoord
transformation, where the 32-bit calculation ends in a zero and the 64-bit calculation does not.)The "obvious" workaround is to turn off FLOAT_CMP and rely on ELLIPSIS to handle the slight discrepancy. But, that could mean adding a lot of ellipsis markers. Is there a better solution?
The text was updated successfully, but these errors were encountered: