Skip to main content

split_amount

Function split_amount 

Source
pub fn split_amount(total: &BigUint, fraction: f64) -> (BigUint, BigUint)
Expand description

Split total into (part, remainder) where part ≈ total * fraction.

Both values always sum exactly to total — no tokens lost to rounding. fraction is clamped to [0.0, 1.0] before use.