diff --git a/base/math.jl b/base/math.jl index 9a5e5377cf6132..704557adc5f2e9 100644 --- a/base/math.jl +++ b/base/math.jl @@ -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 diff --git a/test/missing.jl b/test/missing.jl index 0be8cb8ec9be41..c20dc21f188d34 100644 --- a/test/missing.jl +++ b/test/missing.jl @@ -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 = [&, |, ⊻]