[][src]Crate sp_arithmetic

Minimal fixed point arithmetic primitives and types for runtime.

Modules

biguint

Infinite precision unsigned integer for substrate runtime.

helpers_128bit

Some helper functions to work with 128bit numbers. Note that the functionality provided here is only sensible to use with 128bit numbers because for smaller sizes, you can always rely on assumptions of a bigger type (u128) being available, or simply create a per-thing and use the multiplication implementation provided there.

traits

Primitive traits for the runtime arithmetic.

Structs

Fixed64

An unsigned fixed point number. Can hold any value in the range [-9_223_372_036, 9_223_372_036] with fixed point accuracy of one billion.

Perbill

A fixed point representation of a number between in the range [0, 1].

Percent

A fixed point representation of a number between in the range [0, 1].

Permill

A fixed point representation of a number between in the range [0, 1].

Perquintill

A fixed point representation of a number between in the range [0, 1].

Rational128

A wrapper for any rational number with a 128 bit numerator and denominator.

Traits

PerThing

Something that implements a fixed point ration with an arbitrary granularity X, as parts per X.