From bcb68fcc3d7226eb12010ba06c1f2a8800966e6a Mon Sep 17 00:00:00 2001 From: Mark Thom Date: Wed, 15 Nov 2023 20:38:24 +0100 Subject: [PATCH] fix sign/1 (#2157) --- src/forms.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/forms.rs b/src/forms.rs index a42dda7f7..3a2b743f2 100644 --- a/src/forms.rs +++ b/src/forms.rs @@ -744,7 +744,11 @@ impl Number { Number::Float(f) => Number::Float(OrderedFloat(f.signum())), _ => { if self.is_positive() { - Number::Fixnum(Fixnum::build_with(1)) + if self.is_zero() { + Number::Fixnum(Fixnum::build_with(0)) + } else { + Number::Fixnum(Fixnum::build_with(1)) + } } else if self.is_negative() { Number::Fixnum(Fixnum::build_with(-1)) } else {