Fixed mod bug

This commit is contained in:
2023-08-17 16:38:02 -07:00
parent b846a7c144
commit cc81c3979c
4 changed files with 8 additions and 2 deletions

View File

@ -162,6 +162,11 @@ pub fn eval_operator(context: &mut Context, g: &Expression) -> Result<Option<Exp
if va.fract() != Quantity::new_rational(0f64).unwrap() { return Err((*la + *lb + *op_loc, DaisyError::BadMath)); }
if vb.fract() != Quantity::new_rational(0f64).unwrap() { return Err((*la + *lb + *op_loc, DaisyError::BadMath)); }
let o = va.clone() % vb.clone();
if o.is_nan() {return Err((*la + *lb + *op_loc, DaisyError::BadMath));}
return Ok(Some(Expression::Quantity(*la + *lb + *op_loc, va.clone() % vb.clone())));
} else { return Ok(None); }
} else { return Ok(None); }