1pub mod binary {
3 use typenum::U2;
4
5 use Fix;
6
7 pub type UFix8<Exp> = Fix<u8, U2, Exp>;
8 pub type UFix16<Exp> = Fix<u16, U2, Exp>;
9 pub type UFix32<Exp> = Fix<u32, U2, Exp>;
10 pub type UFix64<Exp> = Fix<u64, U2, Exp>;
11 pub type UFixSize<Exp> = Fix<usize, U2, Exp>;
12
13 #[cfg(feature = "i128")]
14 pub type UFix128<Exp> = Fix<u128, U2, Exp>;
15
16 pub type IFix8<Exp> = Fix<i8, U2, Exp>;
17 pub type IFix16<Exp> = Fix<i16, U2, Exp>;
18 pub type IFix32<Exp> = Fix<i32, U2, Exp>;
19 pub type IFix64<Exp> = Fix<i64, U2, Exp>;
20 pub type IFixSize<Exp> = Fix<isize, U2, Exp>;
21
22 #[cfg(feature = "i128")]
23 pub type IFix128<Exp> = Fix<i128, U2, Exp>;
24}
25
26pub mod decimal {
28 use typenum::U10;
29
30 use Fix;
31
32 pub type UFix8<Exp> = Fix<u8, U10, Exp>;
33 pub type UFix16<Exp> = Fix<u16, U10, Exp>;
34 pub type UFix32<Exp> = Fix<u32, U10, Exp>;
35 pub type UFix64<Exp> = Fix<u64, U10, Exp>;
36 pub type UFixSize<Exp> = Fix<usize, U10, Exp>;
37
38 #[cfg(feature = "i128")]
39 pub type UFix128<Exp> = Fix<u128, U10, Exp>;
40
41 pub type IFix8<Exp> = Fix<i8, U10, Exp>;
42 pub type IFix16<Exp> = Fix<i16, U10, Exp>;
43 pub type IFix32<Exp> = Fix<i32, U10, Exp>;
44 pub type IFix64<Exp> = Fix<i64, U10, Exp>;
45 pub type IFixSize<Exp> = Fix<isize, U10, Exp>;
46
47 #[cfg(feature = "i128")]
48 pub type IFix128<Exp> = Fix<i128, U10, Exp>;
49}
50
51pub mod si {
53 use typenum::{N1, N2, N3, N6, N9, N12, N15, N18, N21, N24};
54 use typenum::{P1, P2, P3, P6, P9, P12, P15, P18, P21, P24};
55 use typenum::{U10, Z0};
56
57 use Fix;
58
59 pub type Yocto<Bits> = Fix<Bits, U10, N24>;
60 pub type Zepto<Bits> = Fix<Bits, U10, N21>;
61 pub type Atto<Bits> = Fix<Bits, U10, N18>;
62 pub type Femto<Bits> = Fix<Bits, U10, N15>;
63 pub type Pico<Bits> = Fix<Bits, U10, N12>;
64 pub type Nano<Bits> = Fix<Bits, U10, N9>;
65 pub type Micro<Bits> = Fix<Bits, U10, N6>;
66 pub type Milli<Bits> = Fix<Bits, U10, N3>;
67 pub type Centi<Bits> = Fix<Bits, U10, N2>;
68 pub type Deci<Bits> = Fix<Bits, U10, N1>;
69
70 pub type Unit<Bits> = Fix<Bits, U10, Z0>;
71
72 pub type Deca<Bits> = Fix<Bits, U10, P1>;
73 pub type Hecto<Bits> = Fix<Bits, U10, P2>;
74 pub type Kilo<Bits> = Fix<Bits, U10, P3>;
75 pub type Mega<Bits> = Fix<Bits, U10, P6>;
76 pub type Giga<Bits> = Fix<Bits, U10, P9>;
77 pub type Tera<Bits> = Fix<Bits, U10, P12>;
78 pub type Peta<Bits> = Fix<Bits, U10, P15>;
79 pub type Exa<Bits> = Fix<Bits, U10, P18>;
80 pub type Zeta<Bits> = Fix<Bits, U10, P21>;
81 pub type Yotta<Bits> = Fix<Bits, U10, P24>;
82}
83
84pub mod iec {
86 use typenum::{P10, P20, P30, P40, P50, P60, P70, P80};
87 use typenum::{U2, Z0};
88
89 use Fix;
90
91 pub type Unit<Bits> = Fix<Bits, U2, Z0>;
92
93 pub type Kibi<Bits> = Fix<Bits, U2, P10>;
94 pub type Mebi<Bits> = Fix<Bits, U2, P20>;
95 pub type Gibi<Bits> = Fix<Bits, U2, P30>;
96 pub type Tebi<Bits> = Fix<Bits, U2, P40>;
97 pub type Pebi<Bits> = Fix<Bits, U2, P50>;
98 pub type Exbi<Bits> = Fix<Bits, U2, P60>;
99 pub type Zebi<Bits> = Fix<Bits, U2, P70>;
100 pub type Yobi<Bits> = Fix<Bits, U2, P80>;
101}