diff --git a/Changelog.md b/Changelog.md index 9b773689ce6..2360ede6f57 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,6 +6,16 @@ * refactoring: Updating and simplifying the runtime system dependencies (#4677). +* motoko-base + + * Breaking change (minor): `Float.format(#hex)` is no longer supported. + This is because newer versions of Motoko (such as with enhanced orthogonal persistence) + rely on the Rust-native formatter that does not offer this functionality. + It is expected that this formatter is very rarely used in practice (dfinity/motoko-base⁠#589). + + * Formatter change (minor): The text formatting of `NaN`, positive or negative, + will be `NaN` in newer Motoko versions, while it was `nan` or `-nan` in older versions (dfinity/motoko-base⁠#589). + ## 0.13.3 (2024-11-13) * motoko (`moc`) @@ -16,7 +26,7 @@ * motoko-base * Add modules `OrderedMap` and `OrderedSet` to replace `RBTree` with improved functionality, performance - and ergonomics avoiding the need for preupgrade hooks (thanks to Serokell) (#662). + and ergonomics avoiding the need for preupgrade hooks (thanks to Serokell) (dfinity/motoko-base⁠#662). ## 0.13.2 (2024-10-18) diff --git a/doc/md/base/Float.md b/doc/md/base/Float.md index 6174070ecec..c7e02ca529b 100644 --- a/doc/md/base/Float.md +++ b/doc/md/base/Float.md @@ -480,7 +480,7 @@ Float.log(Float.e) // => 1.0 ## Function `format` ``` motoko no-repl -func format(fmt : {#fix : Nat8; #exp : Nat8; #gen : Nat8; #hex : Nat8; #exact}, x : Float) : Text +func format(fmt : {#fix : Nat8; #exp : Nat8; #gen : Nat8; #exact}, x : Float) : Text ``` Formatting. `format(fmt, x)` formats `x` to `Text` according to the @@ -489,13 +489,15 @@ formatting directive `fmt`, which can take one of the following forms: * `#fix prec` as fixed-point format with `prec` digits * `#exp prec` as exponential format with `prec` digits * `#gen prec` as generic format with `prec` digits -* `#hex prec` as hexadecimal format with `prec` digits * `#exact` as exact format that can be decoded without loss. `-0.0` is formatted with negative sign bit. -Positive infinity is formatted as `inf`. -Negative infinity is formatted as `-inf`. -`NaN` is formatted as `NaN` or `-NaN` depending on its sign bit. +Positive infinity is formatted as "inf". +Negative infinity is formatted as "-inf". + +Note: The numerical precision and the text format can vary between +Motoko versions and runtime configuration. Moreover, `NaN` can be printed +differently, i.e. "NaN" or "nan", potentially omitting the `NaN` sign. Example: ```motoko