fix sign/1 (#2157)

This commit is contained in:
Mark Thom
2023-11-15 20:38:24 +01:00
parent 4be320abc8
commit bcb68fcc3d

View File

@@ -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 {