-
Notifications
You must be signed in to change notification settings - Fork 21
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
Truncate float NaN behaviour is inconsistent across systems #280
Comments
Probably we should check if err is any sort of NAN (i.e. If we don't want to do that, we should explicity set Does this need to be handled in |
(If in the |
@ketiltrout Do you a preference for doing this check in the |
I would do it in the |
The following function calls
are true on linux but false on macos. Windows is untested.
With macos, calling
bit_truncate_float/bit_truncate_double
witherr=np.nan
evaluates the same aserr=0.0
and returns the input argument - in this case, 32.121. This behaviour is different fromerr=-1
anderr=np.inf
, which both correctly evaluate to0.0
.On linux (Ubuntu, at least), all three cases evaluate to
0.0
.Update: it appears that calling
on macos evaluates to
0
, wheras on linux it evaluates to-9223372036854775808
, the smallest int64 value. It seems that numpy's solution is to throw a RuntimeWarning: numpy/numpy#21166@ketiltrout Do you have any thoughts on how we should handle this in
truncate
?The text was updated successfully, but these errors were encountered: