Module arith

Source
Expand description

Arithmetics helpers

Macros§

checked
Convert arithmetic operators within the given expression to their checked variants and provide detailed error strings about which operator has failed for diagnostic.

Structs§

Error
Checked arithmetics error.

Traits§

CheckedAdd
Performs addition, returning None if overflow occurred.
CheckedDiv
Performs division, returning None on division by zero or if overflow occurred.
CheckedMul
Performs multiplication, returning None if overflow occurred.
CheckedNeg
Performs negation, returning None if the result can’t be represented.
CheckedRem
Performs integral remainder, returning None on division by zero or if overflow occurred.
CheckedSub
Performs subtraction, returning None if overflow occurred.
OverflowingAdd
Performs addition with a flag for overflow.
OverflowingSub
Performs substraction with a flag for overflow.