Number: Compact formatting with significat digits fix#830
Conversation
d8a9d77 to
559a54e
Compare
|
@rxaviers Can you please take a look at this PR. The travis-ci is failing on timeout issue with |
| minimumSignificantDigits: 1, | ||
| maximumSignificantDigits: 3, | ||
| compact: "short" | ||
| }), "12.8B" ); |
There was a problem hiding this comment.
Since these are unit tests, you don't have Globalize available. You need to use format (according to the above tests).
There was a problem hiding this comment.
Let's also add a test where 12850172883 becomes 12.9B
|
Thank you so far |
|
Thanks for the quick fix. Tests are passing, build is failing simply because of commit message which I can fix. Having said that, I want to be sure the code simplification in the round function doesn't cause any side effect and therefore I plan to review this again. It's on my end, I hope to do it soon and will update this PR. |
de61474 to
c84da73
Compare
|
@rxaviers any update on this? |
|
Thank you! Released as 1.4.0-alpha.3 |
Fixes: #821
Removed the logic of rounding the number twice - with a precision of {actual precision required + 2} and then again with the actual precision. This was causing wrong rounding off a number. For eg.
Here the number 12.849872883 is first converted to 12.850 and then when finally rounded off becomes 12.9. But Ideally this should be formatted to 12.8.