core: Patch to fix OverflowError when calling subsn on certain power expressions #14722
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
References to other Issues or PRs
Brief description of what is fixed or changed
This patch fixes #14704
This patch will fix the Overflow Error encountered when the value for n is too large, such that Python is not able to convert it to a float in the expression exp = _log(y,2)/n. It can be fixed simply by changing the expression to exp = int(_log(y,2))/n. Thanks @jksuom for your inputs!
For example: @DRMacIver stated in the Issue #14704 that -
from sympy.abc import a
if name == 'main':
b = a ** a
c = b ** b
c.subs({a: -144})
produces an OverflowError: int too large to convert to float. This short change fixes that
Other comments
This is my first patch for this project. Any constructive feedbacks are most appreciated! :)