From cccef60090cc7e92273eea35e5c2b103c2b35de2 Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 8 Apr 2024 04:42:04 +0200 Subject: [PATCH] better lightyear formatting --- src/nature.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nature.rs b/src/nature.rs index a873c25..bfce955 100644 --- a/src/nature.rs +++ b/src/nature.rs @@ -85,9 +85,9 @@ pub fn ring_density(radius: f32) -> f32 { pub fn readable_distance(distance: f64) -> String { let abs_distance = distance.abs(); - if abs_distance > LIGHTYEAR2METER * 0.001 { + if abs_distance > LIGHTYEAR2METER * 0.01 { let lightyears = distance / LIGHTYEAR2METER; - return format!("{lightyears:.3}ly"); + return format!("{lightyears:.2} ly"); } if abs_distance >= 1.0e10 { let gigameters = distance * 1.0e-9;