Skip to main content

evaluate_node

Function evaluate_node 

Source
pub fn evaluate_node(arena: &DagArena, id: DagNodeId, vars: &[f64]) -> f64
Expand description

Evaluates a single DAG node against the variable bindings, iteratively.

Uses an explicit worklist + value-stack pattern (mirroring the JIT iterative codegen in Phase 2). Depth is limited by heap, not by OS stack, so a million-deep expression no longer overflows.

Panic-free: if the arena is corrupt the function returns whatever partial result it has built so far (typically 0.0).