Crates.io | padic |
lib.rs | padic |
version | 0.1.6 |
source | src |
created_at | 2022-09-23 19:11:17.29872 |
updated_at | 2022-10-04 20:47:57.525808 |
description | P-adic numbers in Rust |
homepage | https://github.com/sneakyweasel/padic-rust |
repository | https://github.com/sneakyweasel/padic-rust |
max_upload_size | |
id | 672659 |
size | 26,261 |
A collection of tools for p-adic numbers in Rust.
This includes a p-adic type and a rational type.
P-adic notation for the expansion is currently left to right.
This library is currently in development and might be unstable.
Add this to your Cargo.toml
:
[dependencies]
padic = "0.1.6"
use padic::Ratio;
let ratio = Ratio::new(2, 5);
let padic = r.to_padic(3, 12);
assert_eq!(padic.valuation, 0);
assert_eq!(padic.expansion, vec![1, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1]);
assert_eq!(padic.expansion_cycle(), [1, 2, 1, 0]);
assert_eq!(padic.to_string(), "... 1 2 1 0 1 2 1 0 1 2 1 1");
MIT