Skip to main content

evaluate_arithmetic_expression

Function evaluate_arithmetic_expression 

Source
pub fn evaluate_arithmetic_expression(
    expression: &ArithExpr,
    bindings: &HashMap<String, ArithmeticValue>,
) -> Result<ArithmeticValue>
Expand description

Evaluate a normalized arithmetic expression without recursive AST traversal.

Binary operations require matching numeric types. Integer operations wrap on overflow. Integer division by zero returns the maximum value of the operand type, integer remainder by zero returns zero, and floating-point zero division follows IEEE 754 with canonical positive NaNs. pow always returns f64. User-defined calls must be expanded before this function is called.