Skip to content

Latest commit

 

History

History
93 lines (41 loc) · 2.37 KB

u256.md

File metadata and controls

93 lines (41 loc) · 2.37 KB

Module 0x1::u256

Function max

Return the larger of x and y

public fun max(x: u256, y: u256): u256

Function min

Return the smaller of x and y

public fun min(x: u256, y: u256): u256

Function diff

Return the absolute value of x - y

public fun diff(x: u256, y: u256): u256

Function divide_and_round_up

Calculate x / y, but round up the result.

public fun divide_and_round_up(x: u256, y: u256): u256

Function multiple_and_divide

Returns x * y / z with as little loss of precision as possible and avoid overflow

public fun multiple_and_divide(x: u256, y: u256, z: u256): u256

Function pow

Return the value of a base raised to a power

public fun pow(base: u256, exponent: u8): u256