Checked Math
Base.CheckedBase.Checked.checked_absBase.Checked.checked_negBase.Checked.checked_addBase.Checked.checked_subBase.Checked.checked_mulBase.Checked.checked_divBase.Checked.checked_remBase.Checked.checked_fldBase.Checked.checked_modBase.Checked.checked_cld
With Overflow
index
Base.Checked — Module
CheckedThe Checked module provides arithmetic functions for the built-in signed and unsigned Integer types which throw an error when an overflow occurs. They are named like checked_sub, checked_div, etc. In addition, add_with_overflow, sub_with_overflow, mul_with_overflow return both the unchecked results and a boolean value denoting the presence of an overflow.
Base.Checked.checked_abs — Function
Base.checked_abs(x)Calculates abs(x), checking for overflow errors where applicable. For example, standard two's complement signed integers (e.g. Int) cannot represent abs(typemin(Int)), thus leading to an overflow.
The overflow protection may impose a perceptible performance penalty.
Base.Checked.checked_neg — Function
Base.checked_neg(x)Calculates -x, checking for overflow errors where applicable. For example, standard two's complement signed integers (e.g. Int) cannot represent -typemin(Int), thus leading to an overflow.
The overflow protection may impose a perceptible performance penalty.
Base.Checked.checked_add — Function
Base.checked_add(x, y)Calculates x+y, checking for overflow errors where applicable.
The overflow protection may impose a perceptible performance penalty.
Base.Checked.checked_sub — Function
Base.checked_sub(x, y)Calculates x-y, checking for overflow errors where applicable.
The overflow protection may impose a perceptible performance penalty.
Base.Checked.checked_mul — Function
Base.checked_mul(x, y)Calculates x*y, checking for overflow errors where applicable.
The overflow protection may impose a perceptible performance penalty.
Base.Checked.checked_div — Function
Base.checked_div(x, y)Calculates div(x,y), checking for overflow errors where applicable.
The overflow protection may impose a perceptible performance penalty.
Base.Checked.checked_rem — Function
Base.checked_rem(x, y)Calculates x%y, checking for overflow errors where applicable.
The overflow protection may impose a perceptible performance penalty.
Base.Checked.checked_fld — Function
Base.checked_fld(x, y)Calculates fld(x,y), checking for overflow errors where applicable.
The overflow protection may impose a perceptible performance penalty.
Base.Checked.checked_mod — Function
Base.checked_mod(x, y)Calculates mod(x,y), checking for overflow errors where applicable.
The overflow protection may impose a perceptible performance penalty.
Base.Checked.checked_cld — Function
Base.checked_cld(x, y)Calculates cld(x,y), checking for overflow errors where applicable.
The overflow protection may impose a perceptible performance penalty.
Base.Checked.add_with_overflow — Function
Base.add_with_overflow(x, y) -> (r, f)Calculates r = x+y, with the flag f indicating whether overflow has occurred.
Base.Checked.sub_with_overflow — Function
Base.sub_with_overflow(x, y) -> (r, f)Calculates r = x-y, with the flag f indicating whether overflow has occurred.
Base.Checked.mul_with_overflow — Function
Base.mul_with_overflow(x, y) -> (r, f)Calculates r = x*y, with the flag f indicating whether overflow has occurred.