1 | // Adapted from https://github.com/Alexhuszagh/rust-lexical. |
2 | |
3 | //! Pre-computed small powers. |
4 | |
5 | // 32 BIT |
6 | #[cfg (limb_width_32)] |
7 | pub(crate) const POW5_32: [u32; 14] = [ |
8 | 1, 5, 25, 125, 625, 3125, 15625, 78125, 390625, 1953125, 9765625, 48828125, 244140625, |
9 | 1220703125, |
10 | ]; |
11 | |
12 | #[cfg (limb_width_32)] |
13 | pub(crate) const POW10_32: [u32; 10] = [ |
14 | 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, |
15 | ]; |
16 | |
17 | // 64 BIT |
18 | #[cfg (limb_width_64)] |
19 | pub(crate) const POW5_64: [u64; 28] = [ |
20 | 1, |
21 | 5, |
22 | 25, |
23 | 125, |
24 | 625, |
25 | 3125, |
26 | 15625, |
27 | 78125, |
28 | 390625, |
29 | 1953125, |
30 | 9765625, |
31 | 48828125, |
32 | 244140625, |
33 | 1220703125, |
34 | 6103515625, |
35 | 30517578125, |
36 | 152587890625, |
37 | 762939453125, |
38 | 3814697265625, |
39 | 19073486328125, |
40 | 95367431640625, |
41 | 476837158203125, |
42 | 2384185791015625, |
43 | 11920928955078125, |
44 | 59604644775390625, |
45 | 298023223876953125, |
46 | 1490116119384765625, |
47 | 7450580596923828125, |
48 | ]; |
49 | pub(crate) const POW10_64: [u64; 20] = [ |
50 | 1, |
51 | 10, |
52 | 100, |
53 | 1000, |
54 | 10000, |
55 | 100000, |
56 | 1000000, |
57 | 10000000, |
58 | 100000000, |
59 | 1000000000, |
60 | 10000000000, |
61 | 100000000000, |
62 | 1000000000000, |
63 | 10000000000000, |
64 | 100000000000000, |
65 | 1000000000000000, |
66 | 10000000000000000, |
67 | 100000000000000000, |
68 | 1000000000000000000, |
69 | 10000000000000000000, |
70 | ]; |
71 | |