Math (Math.sol)

View Source: openzeppelin-solidity/contracts/math/Math.sol

Math

Assorted math operations

Functions

max

Returns the largest of two numbers.

function max(uint256 a, uint256 b) internal pure
returns(uint256)

Arguments

Name

Type

Description

a

uint256

b

uint256

min

Returns the smallest of two numbers.

function min(uint256 a, uint256 b) internal pure
returns(uint256)

Arguments

Name

Type

Description

a

uint256

b

uint256

average

Calculates the average of two numbers. Since these are integers, averages of an even and odd number cannot be represented, and will be rounded down.

function average(uint256 a, uint256 b) internal pure
returns(uint256)

Arguments

Name

Type

Description

a

uint256

b

uint256

Last updated