Closed
Description
hypot(::Int64, ::Float32)
promotes the arguments and result to Float64
, contrary to the behavior of promote
, which gives Float32
in this case.
julia> hypot(1, 3.0f0)
3.1622776601683795
julia> promote(1, 3.0f0)
(1.0f0, 3.0f0)
The culprits are the following method definitions:
Lines 798 to 799 in 71f68b4
Seems like this could be rewritten as follows for consistency with promote
:
hypot(x::Number, y::Number) = _hypot(float.(promote(x, y))...)
hypot(x::Number, y::Number, xs::Number...) = _hypot(float.(promote(x, y, xs...))