Skip to content
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

Extend Base.rationalize instead of defining new function Base.MathConstants.rationalize #56793

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sostock
Copy link
Contributor

@sostock sostock commented Dec 10, 2024

#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.

@nsajko nsajko added backport 1.10 Change should be backported to the 1.10 release backport 1.11 Change should be backported to release-1.11 embarrassing-bugfix Whoops! labels Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 1.10 Change should be backported to the 1.10 release backport 1.11 Change should be backported to release-1.11 embarrassing-bugfix Whoops!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants