[−][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. |
Macros
| assert_eq_error_rate | Copied from |
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. |
| Fixed128 | A signed fixed-point number. Can hold any value in the range [-170_141_183_460_469_231_731, 170_141_183_460_469_231_731] with fixed-point accuracy of 10 ** 18. |
| PerU16 | A fixed point representation of a number in the range [0, 1]. |
| Perbill | A fixed point representation of a number in the range [0, 1]. |
| Percent | A fixed point representation of a number in the range [0, 1]. |
| Permill | A fixed point representation of a number in the range [0, 1]. |
| Perquintill | A fixed point representation of a number 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 |