Skip to content

Conversation

@troy-dunamu
Copy link
Contributor

This patch fixes power when the base is +Infinity and the exponent is a positive fractional exponent.

Since v3.3.0, (+Infinity) ** (positive fractional exponent) raised a FloatDomainError instead of returning +Infinity. The failure came from the precision-preserving path that estimates precision via y*log(x): for positive fractional y, the code enters this estimator and, with x = +Infinity, Math.log10(x.exponent) can evaluate to -Infinity. Attempting to round that non-finite value triggered the exception.

I considered an early-exit approach, but I’m not confident about the mathematical implications, so I made the estimator Infinity-aware instead.

@troy-dunamu troy-dunamu requested a review from tompng November 11, 2025 02:55
Copy link
Member

@tompng tompng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 👍

(CI failure in ruby-2.5 and 2.6 is not related to this change)

@tompng tompng merged commit 9a45a00 into ruby:master Nov 11, 2025
75 of 81 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants