Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

ratio

Ratio & Proportion Calculations (f64)

Utility functions for ratio calculations using 32.32 fixed-point. All division operations return Option<Fixed> to handle zero divisors.

Functions

  • proportion - Calculate part/total ratio
  • scale_by_ratio - Multiply amount by ratio
  • inverse_ratio - Calculate 1/ratio
  • weighted_average - Compute weighted average
  • percentage_change - Calculate % change between values
  • percentage_diff - Calculate absolute % difference

Fully qualified path: cairo_fp::f64::math::ratio

Free functions

proportionCalculates the proportion of part to total. Returns Some(part / total) or None if total is zero.
scale_by_ratio
inverse_ratio
weighted_average
percentage_change
percentage_diff