decimal64 0.0.8

Fast fixed point arithmetic that only uses u64 as internal representation.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
#[macro_export]
macro_rules! gen_scale {
    ($struct_name:ident, $scale:expr, $buffer_len:expr) => {
        #[derive(Debug, Default, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
        pub struct $struct_name;

        impl ScaleMetrics for $struct_name {
            const SCALE: u8 = $scale;
            const SCALE_FACTOR: u64 = 10u64.pow(Self::SCALE as u32);
            const REQUIRED_BUFFER_LEN: usize = $buffer_len;
        }
    };
}