CheckedArithmeticCore.acc
— Methodxacc = acc(x)
Convert x
to type accumulatortype
(typeof(x))
.
CheckedArithmeticCore.accumulatortype
— MethodTnew = accumulatortype(op, T1, T2, ...)
Tnew = accumulatortype(T1, T2, ...)
Return a type Tnew
suitable for accumulation (reduction) of elements of type T
under operation op
.
Examples
julia> accumulatortype(+, UInt8)
UInt64
CheckedArithmeticCore.safearg
— Methodxsafe = CheckedArithmeticCore.safearg(x)
Return a variant xsafe
of x
that is "reasonably safe" for non-overflowing computation. For numbers, this uses CheckedArithmetic.safearg_type
. For containers and other non-number types, specialize safearg
directly.
CheckedArithmeticCore.safearg_type
— FunctionnewT = CheckedArithmeticCore.safearg_type(::Type{T})
Return a "reasonably safe" type newT
for computation with numbers of type T
. For example, for UInt8
one might return UInt128
, because one is much less likely to overflow with UInt128
.
CheckedArithmeticCore.safeconvert
— Methodxc = safeconvert(T, x)
Convert x
to type T
, "safely." This is designed for comparison to results computed by CheckedArithmetic.@check
, i.e., for arguments converted by CheckedArithmeticCore.safearg
.