Merge remote-tracking branch 'refs/remotes/origin/main'

This commit is contained in:
Valerie Wolfe 2024-03-04 20:03:57 -05:00
commit 573806e8e1
3 changed files with 4 additions and 2 deletions

View file

@ -1,6 +1,7 @@
pub const EULER: f64 = 2.718281828459045;
pub const GOLDEN_RATIO: f64 = 1.618033988749895;
pub const LIGHT_SPEED: f64 = 299792458f64;
pub const PI: f64 = 3.141592653589793;
pub const ROOT_TWO: f64 = 1.414213562373095;

View file

@ -15,7 +15,7 @@ pub fn fix(arg: &Value) -> EvalResult {
let count = args.len();
if count != 2 {
return Err(EvalexprError::WrongFunctionArgumentAmount { expected: 2, actual: count });
return Err(EvalexprError::WrongFunctionArgumentAmount { expected: 2..=2, actual: count });
}
let float = args[0].as_float()?;
@ -63,7 +63,7 @@ pub fn logarithm(arg: &Value) -> EvalResult {
output = value.log(base).into();
},
_ => {
return Err(EvalexprError::WrongFunctionArgumentAmount { expected: 2, actual: count });
return Err(EvalexprError::WrongFunctionArgumentAmount { expected: 2..=2, actual: count });
}
}
return Ok(output);

View file

@ -31,6 +31,7 @@ fn main() {
// build eval context
let mut context = context_map! {
// globals
"c" => global::LIGHT_SPEED,
"e" => global::EULER,
"phi" => global::GOLDEN_RATIO,
"pi" => global::PI,