Type Alias fraction::prelude::DynaDecimal

source ·
pub type DynaDecimal<T, P> = GenericDecimal<DynaInt<T, BigUint>, P>;
Expand description

Stack allocated, but dynamically growing into heap if necessary

Allows to use decimals without memory allocations wherever possible. For unexpectedly big values performs on heap and doesn’t suffer from stack overflows. Automatically goes back onto T if an operation with BigUint numbers produces the result that may fit within T.

§Examples

use fraction::DynaDecimal;

type D = DynaDecimal<usize, u8>;

let d1 = D::from("0.462046206206402");
let d2 = D::from(12042002442022044usize);

let d3 = d2 / d1 * D::from(240);

assert_eq!(d3, D::from("6254960104129183747.885873163232639"));

Aliased Type§

struct DynaDecimal<T, P>(/* private fields */);