gen_utils/common/
num.rs

1pub fn format_float(f: f64) -> String {
2    if f.fract() == 0.0 {
3        format!("{:.1}", f)
4    } else {
5        f.to_string()
6    }
7}
8
9pub fn float_to_str(num: f32) -> String {
10    if num.fract() == 0.0 {
11        format!("{}.0", num)
12    } else {
13        format!("{}", num)
14    }
15}