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
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions base/math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,9 @@ for f in (:sin, :cos, :tan, :asin, :atan, :acos,
end
@eval $(f)(::Missing) = missing
end
atan(::Missing, ::Missing) = missing
atan(::Number, ::Missing) = missing
atan(::Missing, ::Number) = missing

exp2(x::AbstractFloat) = 2^x
exp10(x::AbstractFloat) = 10^x
Expand Down
13 changes: 13 additions & 0 deletions test/missing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,19 @@ end
end
end

@testset "two-argument functions" begin
two_argument_functions = [atan]

# All two-argument functions return missing when operating on two missing's
# All two-argument functions return missing when operating on a scalar and an missing
# All two-argument functions return missing when operating on an missing and a scalar
for f in two_argument_functions
@test ismissing(f(missing, missing))
@test ismissing(f(1, missing))
@test ismissing(f(missing, 1))
end
end

@testset "bit operators" begin
bit_operators = [&, |, ⊻]

Expand Down