Skip to content

Commit

Permalink
Add atan support for missings (#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 Dec 27, 2021
1 parent 49e6ae5 commit c790938
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

1 comment on commit c790938

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(ALL, isdaily = true)

Please sign in to comment.