Skip to content

Commit c790938

Browse files
Add atan support for missings (#43523)
Allowing atan to deal with two missing arguments
1 parent 49e6ae5 commit c790938

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

base/math.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,6 +1318,9 @@ for f in (:sin, :cos, :tan, :asin, :atan, :acos,
13181318
end
13191319
@eval $(f)(::Missing) = missing
13201320
end
1321+
atan(::Missing, ::Missing) = missing
1322+
atan(::Number, ::Missing) = missing
1323+
atan(::Missing, ::Number) = missing
13211324

13221325
exp2(x::AbstractFloat) = 2^x
13231326
exp10(x::AbstractFloat) = 10^x

test/missing.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,19 @@ end
109109
end
110110
end
111111

112+
@testset "two-argument functions" begin
113+
two_argument_functions = [atan]
114+
115+
# All two-argument functions return missing when operating on two missing's
116+
# All two-argument functions return missing when operating on a scalar and an missing
117+
# All two-argument functions return missing when operating on an missing and a scalar
118+
for f in two_argument_functions
119+
@test ismissing(f(missing, missing))
120+
@test ismissing(f(1, missing))
121+
@test ismissing(f(missing, 1))
122+
end
123+
end
124+
112125
@testset "bit operators" begin
113126
bit_operators = [&, |, ]
114127

0 commit comments

Comments
 (0)