Expand description
Safe Math
This module contains basic functions to perform arithmetic operations on numerical types of the alloy crate and preventing them from overflowing. Should an operation cause an overflow a result containing TradeSimulationError will be returned. Functions for the types I256, U256, U512 are available.
Functions§
- _construc_
result_ i256 - _construc_
result_ u256 - _construc_
result_ u512 - div_
mod_ u256 - div_
mod_ u512 - safe_
add_ i256 - safe_
add_ u256 - safe_
add_ u512 - safe_
div_ i256 - safe_
div_ u256 - safe_
div_ u512 - safe_
mul_ i256 - safe_
mul_ u256 - safe_
mul_ u512 - safe_
sub_ i256 - safe_
sub_ u256 - safe_
sub_ u512 - sqrt_
u256 - Integer square root for U256, returning U256
- sqrt_
u512 - Computes the integer square root of a U512 value using Newton’s method.