Make sgn(0) equal to 0, closing #106

This commit is contained in:
PaddiM8 2022-12-14 19:03:22 +01:00
parent cca37525c8
commit 5303ea6652

View File

@ -937,8 +937,11 @@ pub mod funcs {
x.clone().div_without_unit(&abs(x)?)
} else {
let (real, _, unit) = as_number_or_return!(x);
Ok(KalkValue::Number(real.signum(), float!(0), unit))
if real == 0f64 {
Ok(KalkValue::Number(float!(0), float!(0), unit))
} else {
Ok(KalkValue::Number(real.signum(), float!(0), unit))
}
}
}