Skip to main content

safe_div

Function safe_div 

Source
pub fn safe_div(num: f64, denom: f64, fallback: f64) -> f64
Expand description

Safe division that returns fallback when the denominator is too small to produce a meaningful result (within 1e-9). Use this for any calculation where a zero-or-near-zero duration could otherwise produce NaN/∞ that silently propagates into transforms or opacity.