Refactor AddExponent overflow/underflow check#368
Merged
tompng merged 1 commit intoruby:masterfrom Jul 11, 2025
Merged
Conversation
BigDecimal's exponent should not overflow/underflow long. To check, BigDecimal restricts the range of vp->exponent. The calculation is complicated and not correct when BASE_FIG is 4.
1b570e0 to
02b9f64
Compare
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.
Just a refactor for BASE_FIG=9 (DECDIG=int32_t) and SIGNED_VALUE is 64bit
Fix this bug
Fix this bug for BASE_FIG=4 (DECDIG=int16_t)
This bug does not happen when BASE_FIG=9 and SIGNED_VALUE is 64bit because
SIGNED_VALUE_MIN + BASE_FIG - 1 == -9223372036854775800is a multiple ofBASE_FIG == 9