Repository navigation
Fix OverflowError in number functions for large integers (#419) - #519
Closed
brubasree007 wants to merge 1 commit into
Closed
brubasree007 wants to merge 1 commit into
brubasree007 wants to merge 1 commit into
Conversation
Member
|
See all the other duplicates linked to #419. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #419
Changes proposed in this pull request:
ordinal,intword,apnumber, andfractional: parse integer values first viaint(value)and catchOverflowErroralongside(TypeError, ValueError), preventing redundant float conversions on discrete integer values.intcomma: ensure integer strings without decimals are parsed as integers before attempting float fallback, avoiding+Infsaturation for large integer strings.scientific: format numbers exceeding standard float bounds usingdecimal.Decimalinto superscript notation without overflow.clampandmetric: short-circuit non-finite checks withif not isinstance(value, int) and not math.isfinite(value):.intword: wrap division inOverflowErrorhandling usingDecimalfor extreme scales beyondpowers.test_number_functions_large_integersintests/test_number.pytesting10**400across all affected functions (all 733 tests pass).