use super::funejson::Value; use super::math_round_float::round_float; use super::money_amount::money; use super::money_format::format_money; /// A money-axis tick: rounded half away from zero to a whole minor unit, then /// printed by money.format. /// /// # Panics /// Panics if `minor` is not finite or the currency is unknown. pub fn format_money_tick(minor: f64, currency: &str) -> String { if !minor.is_finite() { panic!("minor must be a finite number, received {}", minor); } format_money(&money(round_float(minor, 0) as i64, currency)) } pub fn fune_vector(args: &[Value]) -> Value { Value::str(&format_money_tick(args[0].as_f64(), args[1].as_str())) }