seq: Move to uucore/format common number parsing code#7624
Merged
cakebaker merged 6 commits intouutils:mainfrom Apr 3, 2025
Merged
seq: Move to uucore/format common number parsing code#7624cakebaker merged 6 commits intouutils:mainfrom
cakebaker merged 6 commits intouutils:mainfrom
Conversation
|
GNU testsuite comparison: |
5c13284 to
2dbdd7b
Compare
|
GNU testsuite comparison: |
cakebaker
reviewed
Apr 2, 2025
2dbdd7b to
4089cf3
Compare
|
GNU testsuite comparison: |
GNU `seq` doesn't support such large positive exponents anyway, and we are limited by i64 range, so increase the exponent value to make sure we fully overflow that range. Also, add a test to check that a very, very, small number is treated as 0 (that's also undefined behaviour, but it does make sense in a way).
Just use the format provided function.
Also, add a test to check that a very, very, small number is treated as 0. That's probably undefined behaviour, but it does make some sense.
The field was unused, and actually redundant with the precision computed separatedly. This simplifies the code, reintroduces testing.
A lot of the code can be shared, and parsing is quite straightforward as we know that the digit is somewhat valid.
Address review comment.
4089cf3 to
04a1282
Compare
|
GNU testsuite comparison: |
Contributor
|
Thanks! |
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.
This deletes a lot of code in
seq, and moves to the common implementation inuucore.seq: Parse integral and fractional number of digits in the same function
A lot of the code can be shared, and parsing is quite straightforward
as we know that the digit is somewhat valid.
seq: Refactor to actually use PreciseNumber::num_fractional_digits
The field was unused, and actually redundant with the precision
computed separatedly.
This simplifies the code, reintroduces testing.
seq: Accept underflow in parameters
Also, add a test to check that a very, very, small number is
treated as 0. That's probably undefined behaviour, but it does
make some sense.
seq: Remove custom number parsing
Just use the format provided function.
test_seq: Modify undefined behaviour tests
GNU
seqdoesn't support such large positive exponents anyway,and we are limited by i64 range, so increase the exponent value
to make sure we fully overflow that range.
Also, add a test to check that a very, very, small number is
treated as 0 (that's also undefined behaviour, but it does
make sense in a way).