How to calculate the complete product of two numbers without the possibility to overflow in Rust

1 Answer

0 votes
#![feature(bigint_helper_methods)]

fn main() {
    println!("{:?}", 6u32.widening_mul(3)); 

    println!("{:?}", 1_000_000_000u32.widening_mul(30)); 
}





/*
run:

(18, 0)
(4230196224, 6)

*/

 



answered Dec 9, 2022 by avibootz
...