docs.rs failed to build safe-bigmath-0.2.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
safe-bigmath-0.4.1
safe-bigmath
Safe, non-panicking numeric primitives built on pure-Rust num-bigint. safe-bigmath gives you:
SafeInt: arbitrary-precision integers with ergonomic operator overloads.SafeDec<D>: fixed-scale decimals backed by arbitrary-precisionSafeInt; the const genericDsets how many decimal places are stored exactly.- Parsing helpers for turning strings into safe numeric values.
- No hidden panics: division returns
Option, parsing reports structured errors. no_stdby default with an opt-instdfeature; compiles for wasm (wasm32-unknown-unknown).
Quick start
[]
= "0.1.0"
# Optional: enable std support
# safe-bigmath = { version = "0.1.0", features = ["std"] }
Safe integers
use SafeInt;
let a = from;
let b = from;
assert_eq!; // division is fallible
assert_eq!;
assert_eq!; // no panic on zero div
Fixed-scale decimals
use SafeDec;
let price: = "12.50".parse.unwrap;
let qty: = "3.00".parse.unwrap;
let total = price * qty;
assert_eq!;
Pow of ratios with scaling
Compute (x / (x + dx))^(w1 / w2) scaled to perquintill:
use SafeInt;
let x = from;
let dx = from;
let w1 = from;
let w2 = from;
let perquintill = from;
let result = pow_ratio_scaled.unwrap;
assert_eq!;
Feature flags
std(off by default): enablesstdsupport for downstream crates. Default build isno_std+alloc.
Supported targets
no_stdtargets withalloc(default).wasm32-unknown-unknown(CI builds and test-compiles both--no-default-featuresand--all-features).- Any
stdtarget via thestdfeature.
Testing
License
MIT © sam0x17