#bignum #const #big-int

const_num_bigint

const bigint

3 unstable releases

0.2.1 Nov 26, 2021
0.2.0 Nov 25, 2021
0.1.0 Nov 24, 2021

#2355 in Math

Download history 1021/week @ 2024-12-10 615/week @ 2024-12-17 278/week @ 2024-12-24 559/week @ 2024-12-31 938/week @ 2025-01-07 1056/week @ 2025-01-14 660/week @ 2025-01-21 578/week @ 2025-01-28 672/week @ 2025-02-04 479/week @ 2025-02-11 461/week @ 2025-02-18 345/week @ 2025-02-25 626/week @ 2025-03-04 407/week @ 2025-03-11 701/week @ 2025-03-18 944/week @ 2025-03-25

2,773 downloads per month
Used in nalgebra_latex

MIT/Apache

7KB
88 lines

const_num_bigint

const

    use const_num_bigint::*;
    use std::str::FromStr;
    const TEST_INT : &'static BigInt = bigint!("123");
    let bigint = BigInt::from_str("123").unwrap();
    assert!(&bigint==TEST_INT);
    const TEST_INT2 : &'static BigInt = bigint!("-123");
    let bigint2 = BigInt::from_str("-123").unwrap();
    assert!(&bigint2==TEST_INT2);
    const TEST_INT3 : &'static BigInt =
        bigint!("123123123123123123123123123123123123123123123123123123123123123123123123123123");
    let bigint3 = BigInt::from_str(
        "123123123123123123123123123123123123123123123123123123123123123123123123123123"
    ).unwrap();
    assert!(&bigint3==TEST_INT3);
    const TEST_UINT : &'static BigUint = biguint!(
        "123123123123123123123123123123123123123123123123123123123123123123123123123123"
    );
    let biguint = BigUint::from_str(
        "123123123123123123123123123123123123123123123123123123123123123123123123123123"
    ).unwrap();
    assert!(&biguint==TEST_UINT);
    assert!(&biguint==
        biguint!("123123123123123123123123123123123123123123123123123123123123123123123123123123")
    );
    let pi_str = include_str!("pi.num");
    let biguint_pi = BigUint::from_str(pi_str).unwrap();
    assert!(&biguint_pi==
        biguint_file!("src/pi.num")
    );

License: MIT OR Apache-2.0

Dependencies

~2MB
~48K SLoC