Skip to main content

evaluate

Function evaluate 

Source
pub fn evaluate(
    expression: &str,
    lookup: impl FnMut(&str) -> Option<f64>,
) -> GeopResult<f64>
Expand description

The value of the formula expression, with lookup the value of each parameter it names: numbers, + - * / ^, parentheses, pi, and the functions of FUNCTION_NAMES, with angles in degrees — and, last, one comparison of two of those, < <= > >= == !=, 1 where it holds and 0 where not: what says whether a step runs, length > 40 (crate::program::ProgramStep::active). Fails for anything else, for a name lookup does not know, and for a value that is no finite number.