expression

BigInt signed large integers

BigInt handles negative and positive integers of variable size. Parse external text with an explicit radix and check failure. Expected stdout (not executed): -99999999999999999993 Common mistake: Using BigUint for data that must represent a negative value. Dependency: num-bigint =0.4.6. See the staged Cargo fixture. Exact-version API and resolution not tested.

Formal Syntax & Structure

rust syntaxrust
BigInt::from(n); BigInt::parse_bytes(bytes,radix)

Working Example

Example Snippetrust
fn main() {    use num_bigint::BigInt;    let a=BigInt::parse_bytes(b"-100000000000000000000",10).unwrap();    let b=BigInt::from(7);    println!("{}",a+b);}
Rust Reference