big_num_math

Crates.iobig_num_math
lib.rsbig_num_math
version
sourcesrc
created_at2024-06-01 16:26:07.092834
updated_at2024-12-12 23:03:52.131054
descriptionSimple library for computations on large numbers.
homepagehttps://github.com/bravequickcleverfibreyarn/big_num_math
repositoryhttps://github.com/bravequickcleverfibreyarn/big_num_math
max_upload_size
id1258761
Cargo.toml error:TOML parse error at line 22, column 1 | 22 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
boldswiftsmartfiberhank (bravequickcleverfibreyarn)

documentation

https://docs.rs/big_num_math/latest/big_num_math/

README

BIG NUM MATH

Library for computations on large numbers.

  • underdeveloped:
    1. no plan for new functions (goniometric, radix, …)
    2. upcoming optimizations (memory consumption, speed up on some computations, ergonomy, …)
    3. divrem can perform unbearably when divisor is significantly smaller than dividend (as per point 2)
  • primitive simple functions only:
    • addition +substraction,
    • multiplication +division
    • relation operators
    • power

Usage Samples

power
let row = PlacesRow::new_from_num(u128::MAX);
let pow = pow(&row, 500);
let number = pow.to_number();

assert!(number.starts_with("8312324609993336522"));
assert_eq!(19266, number.len());
division with remainder
let dividend = PlacesRow::new_from_str("3402823669209384634633746074317682114565556668744123").unwrap();
let divisor  = PlacesRow::new_from_str(  "14034568236692093846346337460345176821145655563453").unwrap();
let ratio = "242";        
let remainder = "6458155929897923817932408914149323848308022388497";
        
let ratrem = divrem(&dividend, &divisor).unwrap();
        
assert_eq!(ratio, ratrem.0.to_number());
assert_eq!(remainder, ratrem.1.to_number());
decimal places relation
let number    = Row::new_from_str("1489754132134687989463132131").unwrap();
let comparand = Row::new_from_str(        "48645698946456531371").unwrap();
let decrel = rel_dec(&number, &comparand);

assert_eq!(RelDec::Greater((28, 20, 8)), decrel);
Commit count: 44

cargo fmt