SafeMath (SafeMath.sol)
View Source: contracts/tests/SafeMath.sol
SafeMath
Math operations with safety checks that throw on error
Functions
- mul(uint256 a, uint256 b)
- div(uint256 a, uint256 b)
- sub(uint256 a, uint256 b)
- add(uint256 a, uint256 b)
mul
Multiplies two numbers, throws on overflow.
function mul(uint256 a, uint256 b) internal pure
returns(uint256)
Arguments
Name | Type | Description |
---|---|---|
a | uint256 | |
b | uint256 |
div
Integer division of two numbers, truncating the quotient.
function div(uint256 a, uint256 b) internal pure
returns(uint256)
Arguments
Name | Type | Description |
---|---|---|
a | uint256 | |
b | uint256 |
sub
Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
function sub(uint256 a, uint256 b) internal pure
returns(uint256)
Arguments
Name | Type | Description |
---|---|---|
a | uint256 | |
b | uint256 |
add
Adds two numbers, throws on overflow.
function add(uint256 a, uint256 b) internal pure
returns(uint256)
Arguments
Name | Type | Description |
---|---|---|
a | uint256 | |
b | uint256 |