-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent int-float promotion in hypot
#53505
Labels
maths
Mathematical functions
Comments
Another consequence is permutation-asymmetry in the return type julia> hypot(1, 1f0)
1.4142135623730951 # Float64
julia> hypot(1f0, 1)
1.4142135f0 # Float32 |
danielwe
added a commit
to danielwe/julia
that referenced
this issue
Mar 1, 2024
ViralBShah
pushed a commit
that referenced
this issue
Mar 1, 2024
tecosaur
pushed a commit
to tecosaur/julia
that referenced
this issue
Mar 4, 2024
mkitti
pushed a commit
to mkitti/julia
that referenced
this issue
Apr 13, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hypot(::Int64, ::Float32)
promotes the arguments and result toFloat64
, contrary to the behavior ofpromote
, which givesFloat32
in this case.The culprits are the following method definitions:
julia/base/math.jl
Lines 798 to 799 in 71f68b4
Seems like this could be rewritten as follows for consistency with
promote
:The text was updated successfully, but these errors were encountered: