Skip to content

Commit 63db2b1

Browse files
authored
use dragonbox algorithm; alternative to #18008 (#18139)
* use dragonbox algorithm; alternative to #18008 * removed unsafe code
1 parent ba3ec7b commit 63db2b1

File tree

5 files changed

+1408
-50
lines changed

5 files changed

+1408
-50
lines changed

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@
7676
- `json` and `jsonutils` now serialize NaN, Inf, -Inf as strings, so that
7777
`%[NaN, -Inf]` is the string `["nan","-inf"]` instead of `[nan,-inf]` which was invalid json.
7878

79+
- `system.addFloat` now uses the "Dragonbox" algorithm, which ensures correct roundtrips of floating point
80+
numbers, that the minimum length representation of a floating point number is used and correct rounding.
81+
Use `-d:nimLegacyAddFloat` for a transition period.
82+
7983
- `strformat` is now part of `include std/prelude`.
8084

8185
- Deprecated `proc reversed*[T](a: openArray[T], first: Natural, last: int): seq[T]` in `std/algorithm`.

compiler/condsyms.nim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,5 @@ proc initDefines*(symbols: StringTableRef) =
134134
defineSymbol("nimHasUnifiedTuple")
135135
defineSymbol("nimHasIterable")
136136
defineSymbol("nimHasTypeofVoid")
137+
138+
defineSymbol("nimHasDragonBox")

0 commit comments

Comments
 (0)