pub fn complementary_decomposition<const BASE: u64, const N: usize>(
value: i64,
) -> Option<([u16; N], bool)>Expand description
Decompose a number into N digits in a given BASE, MSB first, in the complementary representation, i.e.
value = b * BASE^N - (d[0] * BASE^(N-1) + d[1] * BASE^(N-2) + ... + d[N-1] * BASE^0)
where (d, b) is the result.
Returns None iff value is out of range.
§Requires:
log2(BASE) * N <= 64BASE <= (1 << 16)
§Example:
let decomp = complementary_decomposition::<2, 3>(3);
assert_eq!(decomp, Some(([1, 0, 1], true)));