Skip to main content

evaluate

Function evaluate 

Source
pub fn evaluate<N: Number>(input: &str) -> Result<N, Error>
where Math: Context<N>,
Expand description

Evaluates input with the constants and functions of Math.

assert_eq!(nanoexpr::evaluate::<f64>("sqrt(16) + 2 ^ 3"), Ok(12.0));
assert_eq!(nanoexpr::evaluate::<f32>("max(1, cos(0), 0.5)"), Ok(1.0));