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

core: Patch to fix OverflowError when calling subsn on certain power expressions #14722

Closed

Conversation

htrivedi04
Copy link

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! :)

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!
@sidhantnagpal
Copy link
Member

There is an existing PR: #14707, for the fix. You can check referencing PRs in the issue (which might attempt to fix the issue).

@Abdullahjavednesar
Copy link
Member

Abdullahjavednesar commented May 18, 2018

The PR currently fixing the issue is active, if it fails to fix you can continue.

@kenluck2001
Copy link

Can I start my journey into sympy project with this PR?

@czgdp1807
Copy link
Member

Closing in favour of #17636

@czgdp1807 czgdp1807 closed this Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OverflowError when calling subsn on certain power expressions
6 participants