Skip to main content

FPUnsignedOperators

isEqual

Whether a is equal to b.

function isEqual(FPUnsigned a, FPUnsigned b) internal pure returns (bool)

Parameters

NameTypeDescription
aFPUnsigneda FPUnsigned.
bFPUnsignedb FPUnsigned.

Return Values

NameTypeDescription
[0]boolTrue if equal, or False.

isNotEqual

Whether a is equal to b.

function isNotEqual(FPUnsigned a, FPUnsigned b) internal pure returns (bool)

Parameters

NameTypeDescription
aFPUnsigneda FPUnsigned.
bFPUnsignedb FPUnsigned.

Return Values

NameTypeDescription
[0]boolTrue if equal, or False.

isGreaterThan

Whether a is greater than b.

function isGreaterThan(FPUnsigned a, FPUnsigned b) internal pure returns (bool)

Parameters

NameTypeDescription
aFPUnsigneda FPUnsigned.
bFPUnsignedb FPUnsigned.

Return Values

NameTypeDescription
[0]boolTrue if a > b, or False.

isGreaterThanOrEqual

Whether a is greater than or equal to b.

function isGreaterThanOrEqual(FPUnsigned a, FPUnsigned b) internal pure returns (bool)

Parameters

NameTypeDescription
aFPUnsigneda FPUnsigned.
bFPUnsignedb FPUnsigned.

Return Values

NameTypeDescription
[0]boolTrue if a >= b, or False.

isLessThan

Whether a is less than b.

function isLessThan(FPUnsigned a, FPUnsigned b) internal pure returns (bool)

Parameters

NameTypeDescription
aFPUnsigneda FPUnsigned.
bFPUnsignedb FPUnsigned.

Return Values

NameTypeDescription
[0]boolTrue if a < b, or False.

isLessThanOrEqual

Whether a is less than or equal to b.

function isLessThanOrEqual(FPUnsigned a, FPUnsigned b) internal pure returns (bool)

Parameters

NameTypeDescription
aFPUnsigneda FPUnsigned.
bFPUnsignedb FPUnsigned.

Return Values

NameTypeDescription
[0]boolTrue if a <= b

add

Adds two FPUnsigneds, reverting on overflow.

function add(FPUnsigned a, FPUnsigned b) internal pure returns (FPUnsigned)

Parameters

NameTypeDescription
aFPUnsigneda FPUnsigned.
bFPUnsignedb FPUnsigned.

Return Values

NameTypeDescription
[0]FPUnsignedthe sum of a and b.

sub

Subtracts two FPUnsigneds, reverting on overflow.

function sub(FPUnsigned a, FPUnsigned b) internal pure returns (FPUnsigned)

Parameters

NameTypeDescription
aFPUnsigneda FPUnsigned.
bFPUnsignedb FPUnsigned.

Return Values

NameTypeDescription
[0]FPUnsignedthe difference of a and b.

mul

Multiplies two FPUnsigneds, reverting on overflow.

function mul(FPUnsigned a, FPUnsigned b) internal pure returns (FPUnsigned)
Dev note

This will "floor" the product.

Parameters

NameTypeDescription
aFPUnsigneda FPUnsigned.
bFPUnsignedb FPUnsigned.

Return Values

NameTypeDescription
[0]FPUnsignedthe product of a and b.

div

Divides one FPUnsigned by an FPUnsigned, reverting on overflow or division by 0.

function div(FPUnsigned a, FPUnsigned b) internal pure returns (FPUnsigned)
Dev note

This will "floor" the quotient.

Parameters

NameTypeDescription
aFPUnsigneda FPUnsigned numerator.
bFPUnsigneda FPUnsigned denominator.

Return Values

NameTypeDescription
[0]FPUnsignedthe quotient of a divided by b.

divCeil

Divides one FPUnsigned by an FPUnsigned, reverting on overflow or division by 0.

function divCeil(FPUnsigned a, FPUnsigned b) internal pure returns (FPUnsigned)
Dev note

This will ceil the quotient.

Parameters

NameTypeDescription
aFPUnsigneda FPUnsigned numerator.
bFPUnsigneda FPUnsigned denominator.

Return Values

NameTypeDescription
[0]FPUnsignedthe quotient of a divided by b.

roundUp

Convert a FPUnsigned.FPUnsigned to uint, rounding up any decimal portion.

function roundUp(FPUnsigned value) internal pure returns (uint256)

trunc

Convert a FPUnsigned.FPUnsigned to uint, "truncating" any decimal portion.

function trunc(FPUnsigned value) internal pure returns (uint256)

floor

Round a FPUnsigned.Unsigned down to the nearest integer.

function floor(FPUnsigned value) internal pure returns (FPUnsigned)

ceil

Round a FPUnsigned.Unsigned up to the nearest integer.

function ceil(FPUnsigned value) internal pure returns (FPUnsigned)

neg

Negate a FPUnsigned

function neg(FPUnsigned a) internal pure returns (FPSigned)

Parameters

NameTypeDescription
aFPUnsignedValue to negate

Return Values

NameTypeDescription
[0]FPSignedFPSigned a * -1