Skip to content

Commit

Permalink
Base: power_by_squaring: don't require one
Browse files Browse the repository at this point in the history
* Follows up on/partially reverts JuliaLang#55634
* Reopens JuliaLang#53504, perhaps it's OK to require some types to implement
  their own `^`
* Fixes JuliaLang#57390, a regression
  • Loading branch information
nsajko committed Feb 28, 2025
1 parent 2dd4cdf commit 609748d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion base/intfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ end

# ^ for any x supporting *
function to_power_type(x::Number)
T = promote_type(typeof(x), typeof(one(x)), typeof(x*x))
T = promote_type(typeof(x), typeof(x*x))
convert(T, x)
end
to_power_type(x) = oftype(x*x, x)
Expand Down

0 comments on commit 609748d

Please sign in to comment.