Skip to content

Commit

Permalink
Merge pull request JuliaLang#8940 from gasagna/patch-1
Browse files Browse the repository at this point in the history
Name atan2 arguments consistently
  • Loading branch information
ivarne committed Nov 8, 2014
2 parents 64aa84d + 0ed5905 commit 93303ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion base/float16.jl
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ for func in (:sin,:cos,:tan,:asin,:acos,:atan,:sinh,:cosh,:tanh,:asinh,:acosh,
$func(a::Complex32) = complex32($func(complex64(a)))
end
end
atan2(a::Float16, b::Float16) = float16(atan2(float32(a), float32(b)))
atan2(y::Float16, x::Float16) = float16(atan2(float32(y), float32(x)))
hypot(a::Float16, b::Float16) = float16(hypot(float32(a), float32(b)))
ldexp(a::Float16, b::Integer) = float16(ldexp(float32(a), b))
exponent(x::Float16) = exponent(float32(x))
Expand Down
8 changes: 4 additions & 4 deletions base/math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,13 @@ function hypot{T<:FloatingPoint}(x::T, y::T)
x * sqrt(one(r)+r*r)
end

atan2(x::Real, y::Real) = atan2(promote(float(x),float(y))...)
atan2{T<:FloatingPoint}(x::T, y::T) = Base.no_op_err("atan2", T)
atan2(y::Real, x::Real) = atan2(promote(float(y),float(x))...)
atan2{T<:FloatingPoint}(y::T, x::T) = Base.no_op_err("atan2", T)

for f in (:atan2, :hypot)
@eval begin
($f)(x::Float64, y::Float64) = ccall(($(string(f)),libm), Float64, (Float64, Float64,), x, y)
($f)(x::Float32, y::Float32) = ccall(($(string(f,"f")),libm), Float32, (Float32, Float32), x, y)
($f)(y::Float64, x::Float64) = ccall(($(string(f)),libm), Float64, (Float64, Float64,), y, x)
($f)(y::Float32, x::Float32) = ccall(($(string(f,"f")),libm), Float32, (Float32, Float32), y, x)
@vectorize_2arg Number $f
end
end
Expand Down

0 comments on commit 93303ec

Please sign in to comment.