Repository navigation
Conversation
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.
Number formats now round in two steps, matching Excel: first the exact value is rounded to 15 significant digits, with a tie going toward zero; then that decimal is rounded to the pattern's last digit, with a tie going away from zero. Digits are always written out in full, so large and small values no longer appear as
e+21or similar.1.005with0.00gives1.01(was1.00)2 ** 70with#,##0gives1,180,591,620,717,410,000,000(was garbled)999.96with##0.0E+0gives1.0E+3Generalrounds a tie at the tenth digit up, as Excel doesThis is an alternative to #93, using a faster, arithmetic-based approach.
Notable differences from #93
Engineering notation when rounding carries:
##0.0E+0999.961000.0E+01.0E+3##0.0E+09999601000.0E+31.0E+6##0.0E+0999999999999999 + 0.51000.0E+121.0E+15Generalwith a tie at the tenth digit:4.23947917454.2394791744.23947917519147467.11519147467.1119147467.1242299445.99542299445.9942299446This is because
round()now follows the same rules as the formats:masterround(1.005, 2)11.01round(0.285, 2)0.280.29round(1e15 + 5)10000000000000051000000000000000Vulgar fractions keep the old rounding, which matches Excel more closely. A known difference is recorded as an expected-failure test.