Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend
Base.rationalize
instead of defining new function (#56793)
#55886 accidentally created a new function `Base.MathConstants.rationalize` instead of extending `Base.rationalize`, which is the reason why `Base.rationalize(Int, π)` isn’t constant-folded in Julia 1.10 and 1.11: ``` julia> @Btime rationalize(Int,π); 1.837 ns (0 allocations: 0 bytes) # v1.9: constant-folded 88.416 μs (412 allocations: 15.00 KiB) # v1.10: not constant-folded ``` This PR fixes that. It should probably be backported to 1.10 and 1.11. (cherry picked from commit d3c26b7)
- Loading branch information