Function calc_ratio

Source
pub fn calc_ratio(child: u64, parent: u64) -> String
Expand description

Calculates a ratio between two numbers, handling division by zero.

§Arguments

  • child - The numerator. (comparison)
  • parent - The denominator. (base)

§Returns

A string representing the ratio, or “0.0” if the denominator is zero.