From cbd8a8755765b30371cb6781eac1e83bad1c75cf Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Tue, 9 Nov 2021 08:43:35 +0800 Subject: [PATCH] Fix floating-point display. --- src/ast.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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()