pub fn pretty_print_float(n: f64, allow_sn: bool) -> String
Expand description

The function that pretty prints the floating number Since rust doesn’t have anything that can format a float with out appearance, so we just implement a float pretty printing function, which finds the shortest representation of a floating point number within the allowed error range.

  • n: The float number to pretty-print
  • allow_sn: Should we use scientific notation when possible
  • returns: The pretty printed string