var._applyOp

private T _applyOp(string op, T)(T a, T b) @safe pure nothrow @nogc

Apply a binary arithmetic operation.

For division and modulo with integer types, callers MUST check that b != 0 before calling this function and handle the zero-divisor case appropriately (e.g., by returning var.init). The defensive check inside this function returns T.init (which is 0 for integers) as a last resort, but this value is indistinguishable from a valid result and should never be relied upon.

For floating-point types, division/modulo by zero follows IEEE 754 semantics (producing infinity or NaN) and requires no pre-check.

Parameters

opThe operation: `"+"`, `"-"`, `"*"`, `"/"`, or `"%"`.
aLeft operand.
bRight operand.

Returns

The result of applying the operation.