Function checkedMulAdd

Compute base + factor * value without overflow.

bool checkedMulAdd(
  long base,
  long factor,
  long value,
  out long result
) pure nothrow @nogc @safe;

This helper is intended for exact affine transformations such as PBF coordinate reconstruction.

Parameters

NameDescription
base Additive base value.
factor Multiplicative factor.
value Value to multiply by factor.
result Receives the exact result when the operation succeeds.

Returns

true when both multiplication and addition are representable as long; false otherwise.