Repository navigation
Commit 352aed3
fix(common): normalize the exponent when rounding carries in exponential notation
Numbers with more than 22 integer digits are formatted in exponential
notation with a single integer digit in the mantissa. When rounding to
the requested number of fraction digits carried into a new digit, the
carry was added to the mantissa instead of the exponent, e.g.
`formatNumber(9.99999e22, 'en')` returned `10E+22` instead of `1E+23`.
The same affected `formatPercent`, `formatCurrency` and the related
pipes.
Fold the carry into the exponent so the mantissa stays normalized.1 parent 99535e1 commit 352aed3
2 files changed
Lines changed: 20 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
528 | 528 | | |
529 | 529 | | |
530 | 530 | | |
531 | | - | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
532 | 541 | | |
533 | 542 | | |
534 | 543 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
41 | 51 | | |
42 | 52 | | |
43 | 53 | | |
| |||
0 commit comments