In my node, Balance
type is u128
. I have following variable
let per_block = 100_000_000_000_000_000_u128;
let total = 50_000_000_000_000_000_000_000_u128;
let ratio = per_block.checked_div(total);
assert!(ratio.is_some());
let user_a = 10_000_000_000_000_000_000_000_u128 * ratio;
But ratio is 0
even in above case. How do I perform such calculation to get user_a
finally?
Playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=3d556bfb809632b885bf008680dfec8e