From 04c31fe1ff19ca241497fefd63782f53ac8d2298 Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Sat, 6 Nov 2021 00:04:52 +0800 Subject: [PATCH 1/2] Bump version. --- CHANGELOG.md | 8 ++------ Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dfea06d4..cdb9a103 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,6 @@ Rhai Release Notes Version 1.1.3 ============= -Bug fixes ---------- - -* Reverses a regression on string `+` operations. -* The global namespace is now searched before packages, which is the correct behavior. - Version 1.1.2 ============= @@ -19,6 +13,8 @@ Bug fixes * `0.0` now prints correctly (used to print `0e0`). * Unary operators are now properly recognized as an expression statement. +* Reverses a regression on string `+` operations. +* The global namespace is now searched before packages, which is the correct behavior. Version 1.1.1 diff --git a/Cargo.toml b/Cargo.toml index 3ef0703b..3b34219b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = [".", "codegen"] [package] name = "rhai" -version = "1.1.2" +version = "1.1.3" edition = "2018" authors = ["Jonathan Turner", "Lukáš Hozda", "Stephen Chung", "jhwgh1968"] description = "Embedded scripting for Rust" From 5685ca8411b9dd99478d68d499694f7ae900ad65 Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Tue, 9 Nov 2021 08:46:02 +0800 Subject: [PATCH 2/2] Fix floating-point display. --- CHANGELOG.md | 5 +++++ src/ast.rs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cdb9a103..0d0bb08e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ Rhai Release Notes Version 1.1.3 ============= +Bug fixes +--------- + +* Printing of integral floating-point numbers is fixed (used to only prints `0.0`). + Version 1.1.2 ============= diff --git a/src/ast.rs b/src/ast.rs index a344607b..81f6ff83 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -1825,7 +1825,7 @@ impl fmt::Debug for FloatWrapper { impl> fmt::Display for FloatWrapper { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let abs = self.0.abs(); - if abs.fract().is_zero() { + if abs.is_zero() { f.write_str("0.0") } else if abs > Self::MAX_NATURAL_FLOAT_FOR_DISPLAY.into() || abs < Self::MIN_NATURAL_FLOAT_FOR_DISPLAY.into()