Skip to content

Commit

Permalink
Add missing support to hypot and log(b,x) (JuliaLang#43601)
Browse files Browse the repository at this point in the history
  • Loading branch information
garrison authored and LilithHafner committed Feb 22, 2022
1 parent 9054f1b commit 6d18828
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions base/math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1318,9 +1318,12 @@ 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

for f in (:atan, :hypot, :log)
@eval $(f)(::Missing, ::Missing) = missing
@eval $(f)(::Number, ::Missing) = missing
@eval $(f)(::Missing, ::Number) = missing
end

exp2(x::AbstractFloat) = 2^x
exp10(x::AbstractFloat) = 10^x
Expand Down
2 changes: 1 addition & 1 deletion test/missing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ end
end

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

# 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
Expand Down

0 comments on commit 6d18828

Please sign in to comment.