-
-
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
Add atan support for missings #43523
Conversation
allowing atan to deal with two missing arguments
This seems reasonable given that we already define |
Thank you for the pull request (the first ever submitted from your account, according to GitHub!).
|
base/math.jl
Outdated
@@ -1318,6 +1318,7 @@ for f in (:sin, :cos, :tan, :asin, :atan, :acos, | |||
end | |||
@eval $(f)(::Missing) = missing | |||
end | |||
atan(::Missing,::Missing) = missing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line would be more consistent with the rest of the julia code base if a space were added after the comma. (Although there are a handful of exceptions, the space is present much more often than it is not.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, garrison! I have just added support for the cases where one of the values is missing and the other is not. I believe ::Number
is better for this than ::Any
but am not sure!
atan(::Missing, ::Missing) = missing
atan(::Number, ::Missing) = missing
atan(::Missing, ::Number) = missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that ::Number
makes the most sense, as it makes this consistent with other two-argument math functions (e.g. *
, /
).
Added space after the commas. Added cases for one of the values being missing.
I think the easiest ( EDIT: Actually, I believe it makes better sense to start a testset for "two-argument functions" right below "elementary functions." Others for which |
started with atan; can be expanded to log, hypot.
Added now (and it looks like the checks passed now after I had quite a few issues with the white space bot, my apologies!) as it’s written now, I left atan in the “elementary functions” test set as well for the one input test, though this could definitely be changed if it would be better practice to only have it in one place. |
This is in the spirit of JuliaLang#43523, which added `missing` support for the two-argument form of `atan`.
This is in the spirit of JuliaLang#43523, which added `missing` support for the two-argument form of `atan`.
This is in the spirit of JuliaLang#43523, which added `missing` support for the two-argument form of `atan`.
Allowing atan to deal with two missing arguments
Allowing atan to deal with two missing arguments
allowing atan to deal with two missing arguments