3 releases
0.1.2 | Oct 1, 2020 |
---|---|
0.1.1 | Oct 1, 2020 |
0.1.0 | Oct 1, 2020 |
#1010 in Math
6KB
132 lines
radix-tools
Tools for iteratively computing powers or decomposing numbers by radix.
Documentation
Docs may be found here.
lib.rs
:
Simple tools to compute powers of a radix, or the radix decomposition of a number.
Examples
Compute the 5th power of 7:
use radix_tools::powers::*;
assert_eq!(7*7*7*7*7, Powers::new(1u32, 7u32).nth(5).unwrap());
Compute the 2nd ternary (radix-3) digit of 42:
use radix_tools::decomposition::*;
assert_eq!(2, RadixDecomposer::new(3u32, 42u32).nth(1).unwrap());