Skip to content
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

Merged
merged 7 commits into from
Dec 27, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions base/math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,7 @@ for f in (:sin, :cos, :tan, :asin, :atan, :acos,
end
@eval $(f)(::Missing) = missing
end
atan(::Missing,::Missing) = missing
Copy link
Member

@garrison garrison Dec 23, 2021

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.)

Copy link
Contributor Author

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

Copy link
Member

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. *, /).


exp2(x::AbstractFloat) = 2^x
exp10(x::AbstractFloat) = 10^x
Expand Down