From 19aed2a21618399b9fa53183ab1110a6a5feefcc Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Sat, 24 Dec 2022 20:10:33 -0700 Subject: [PATCH] Unit.toString() now displays NaN as N/A. This brings it in agreement with Unit.toStringUnit() --- core/src/net/sf/openrocket/unit/Unit.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/net/sf/openrocket/unit/Unit.java b/core/src/net/sf/openrocket/unit/Unit.java index 4c4195b15..fd0f97ac6 100644 --- a/core/src/net/sf/openrocket/unit/Unit.java +++ b/core/src/net/sf/openrocket/unit/Unit.java @@ -90,8 +90,11 @@ public abstract class Unit { * @return A string representation of the number in these units. */ public String toString(double value) { - double val = toUnit(value); + if (Double.isNaN(value)) + return "N/A"; + double val = toUnit(value); + if (Math.abs(val) > 1E6) { return expFormat.format(val); }