-
-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add scientific notation for BigDecimal formatting and improve handlin…
…g of numbers (#3911) Co-authored-by: Giulio Canti <giulio.canti@gmail.com>
- Loading branch information
Showing
4 changed files
with
290 additions
and
121 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
"effect": minor | ||
--- | ||
|
||
Added `BigDecimal.toExponential` for scientific notation formatting of `BigDecimal` values. | ||
|
||
The implementation of `BigDecimal.format` now uses scientific notation for values with | ||
at least 16 decimal places or trailing zeroes. Previously, extremely large or small values | ||
could cause `OutOfMemory` errors when formatting. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
"effect": minor | ||
--- | ||
|
||
Added `BigDecimal.unsafeFromNumber` and `BigDecimal.safeFromNumber`. | ||
|
||
Deprecated `BigDecimal.fromNumber` in favour of `BigDecimal.unsafeFromNumber`. | ||
|
||
The current implementation of `BigDecimal.fromNumber` and `BigDecimal.unsafeFromNumber` now throws | ||
a `RangeError` for numbers that are not finite such as `NaN`, `+Infinity` or `-Infinity`. |
This file contains 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
Oops, something went wrong.