better lightyear formatting
This commit is contained in:
parent
ac9ee34e1f
commit
cccef60090
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue