View Source: openzeppelin-solidity/contracts/math/SafeMath.sol
SafeMath
Math operations with safety checks that throw on error
- mul(uint256 _a, uint256 _b)
- div(uint256 _a, uint256 _b)
- sub(uint256 _a, uint256 _b)
- add(uint256 _a, uint256 _b)
Multiplies two numbers, throws on overflow.
function mul(uint256 _a, uint256 _b) internal pure
returns(c uint256)
Arguments
Name | Type | Description |
---|---|---|
_a | uint256 | |
_b | uint256 |
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 |
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 |
Adds two numbers, throws on overflow.
function add(uint256 _a, uint256 _b) internal pure
returns(c uint256)
Arguments
Name | Type | Description |
---|---|---|
_a | uint256 | |
_b | uint256 |