-
Attributes:
#[defines_primitive(#[u8])]
Return the larger of x
and y
Return the smaller of x
and y
Return the absolute value of x - y
Calculate x / y, but round up the result.
public fun divide_and_round_up(x: u8, y: u8): u8
Returns x * y / z with as little loss of precision as possible and avoid overflow
public fun multiple_and_divide(x: u8, y: u8, z: u8): u8
Return the value of a base raised to a power
Get a nearest lower integer Square Root for x
. Given that this
function can only operate with integers, it is impossible
to get perfect (or precise) integer square root for some numbers.
Example:
u8::sqrt(9) => 3
u8::sqrt(8) => 2 // the nearest lower square root is 4;