Skip to content

Commit

Permalink
Add atan support for missings (JuliaLang#43523)
Browse files Browse the repository at this point in the history
Allowing atan to deal with two missing arguments
  • Loading branch information
nicholasbalasus authored and LilithHafner committed Mar 8, 2022
1 parent 76c51b6 commit 9238fdd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
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

0 comments on commit 9238fdd

Please sign in to comment.