]> Repositorios git - scryer-prolog.git/commitdiff
fix sign/1 (#2157)
authorMark Thom <[email protected]>
Wed, 15 Nov 2023 19:38:24 +0000 (20:38 +0100)
committerMark Thom <[email protected]>
Wed, 15 Nov 2023 19:38:24 +0000 (20:38 +0100)
src/forms.rs

index a42dda7f71c45e0e74b1ed43ac4449cd90c992e0..3a2b743f2e043b62fcb2514310500c43d7741f73 100644 (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 {