SafeMath
library SafeMath
Math operations with safety checks that throw on error.
Reference
Functions
add
function add(uint256 _a, uint256 _b) internal pure returns (uint256)Adds two numbers, throws on overflow.
- Parameters:
_a- uint256_b- uint256- Returns:
- uint256
div
function div(uint256 _a, uint256 _b) internal pure returns (uint256)Integer division of two numbers, truncating the quotient.
- Parameters:
_a- uint256_b- uint256- Returns:
- uint256
mul
function mul(uint256 _a, uint256 _b) internal pure returns (uint256)Multiplies two numbers, throws on overflow.
- Parameters:
_a- uint256_b- uint256- Returns:
- uint256
sub
function sub(uint256 _a, uint256 _b) internal pure returns (uint256)Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
- Parameters:
_a- uint256_b- uint256- Returns:
- uint256