Skip to main content

eval_arithmetic

Function eval_arithmetic 

Source
pub fn eval_arithmetic(relation: &str, args: &[f64]) -> Option<bool>
Expand description

Evaluate a built-in arithmetic predicate x1 = x2 op x3 over three numbers.

Returns Some(true|false) for pilji/sumji/dilcu given at least three arguments, and None otherwise (unknown relation or too few args) so the caller falls through to the external compute backend.

Equality is TOLERANT (isclose, rel_tol 1e-9), so decimal queries such as 0.3 = 0.1 + 0.2 answer TRUE despite IEEE-754 rounding — the engine, the host, and the Python backend all agree. The dilcu divide-by-zero check is an exact == 0.0 guard (a guard, not a result comparison).