float_to_fixed

Function float_to_fixed 

Source
pub fn float_to_fixed(value: f64, precision: usize) -> String
Expand description

Formats a floating-point number with specified precision

Converts float to string with fixed number of decimal places Supports precision from 0 to 4 decimal places

§Arguments

  • value - Floating point number to format
  • precision - Number of decimal places (0-4)

§Returns

  • String containing formatted number

§Examples

assert_eq!("1.12", float_to_fixed(1.123412, 2));
assert_eq!("1", float_to_fixed(1.123412, 0));