Skip to content

binaryOp

function binaryOp(
l,
r,
op,
bigOp?,
symbolicOp?): Value;

Defined in: packages/engine/src/vm/VMConversion.ts:253

Apply a numeric binary operation with type-aware dispatch. Handles BigInt, UoM, Vector, Symbolic, and plain Number operands.

ParameterTypeDescription
lValue-
rValue-
op(a, b) => number-
bigOp?(a, b) => bigint-
symbolicOp?"sub" | "add" | "mul" | "div"which SymbolicNode kind to build when either operand is Symbolic (symbolic/SymbolicNode.ts). Only ADD/SUB/MUL/DIV pass this (the “four arithmetic opcodes” the symbolic-algebra phase scopes itself to), MOD’s own call site passes nothing, so a Symbolic operand there falls through to the ordinary numeric path (toNumber() -> 0), an explicit, disclosed scope boundary rather than an oversight.

Value