DRAFTThis page is not published. Only visible in development mode.
Functions

Arithmetic Overflow & none Policies

Every arithmetic function family (math::add, math::sub, math::mul, math::div, math::rem) has explicit variants that decide what happens on overflow or missing input.

The policies

VariantBehavior
math::add::noneReturns none on missing input or overflow.
math::add::saturateClamps to the type's minimum or maximum on overflow.
math::add::wrapWraps around on overflow (two's complement).
math::add::zeroReturns zero on missing input or overflow.
math::add::defaultReturns the type's default value.
math::add::strictFails the statement on missing input or overflow.

Why explicit policies

Silent overflow and silently propagated missing values are the two classic numeric bugs. Naming the policy in the function makes the behavior visible in the query. This page will document each family with runnable examples per policy.