Skip to content

Commit

Permalink
fix sign/1 (#2157)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Thom committed Nov 15, 2023
1 parent 4be320a commit bcb68fc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/forms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit bcb68fc

Please sign in to comment.