-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
rem2pi
called with NaN
returns constant number instead of NaN
#32888
Comments
rem2pi
called with NaN
returns constant number instead of NaN
I think we can solve this bug by checking for NaN argument explicitly in rem2pi. |
Currently, |
I think Also, should |
For performance reasons alone i would prefer Thank you for working on this. :) |
I agree about the performance impact of Errors, but most of the trigonometric functions in base/math.jl throw Errors on Hence, I thought it's a good idea to continue that behaviour. |
These functions are generally expensive enough that the difference between returning nan and throwing an error doesn’t matter. |
With the exception that functions that throw now has a side effect and can't be optimized away even if the result is unused / multiple calls with the same argument can't be folded together etc. It's a pretty big semantic difference. As an example
|
|
Calling
rem2pi
with aNaN
(alsoNaN16
,NaN32
,NaN128
) returns, depending on the rounding mode, the constants1.3470949413735402
or-4.936090365806046
which is obviously incorrect.This also means that
mod2pi
is incorrect.The text was updated successfully, but these errors were encountered: