From 4ba2e0f219963490c5ada6f86ecba05ec5cf9400 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Mon, 30 Mar 2020 21:31:16 -0400 Subject: [PATCH] Use infinity symbol for Quantity display string instead of "inf". --- src/Quantity.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Quantity.cpp b/src/Quantity.cpp index 143228a7..b17631c0 100644 --- a/src/Quantity.cpp +++ b/src/Quantity.cpp @@ -20,7 +20,14 @@ int Quantity::getDisplayPrecision() { } std::string Quantity::getDisplayValueString() { - return string::f("%.*g", getDisplayPrecision(), math::normalizeZero(getDisplayValue())); + float v = getDisplayValue(); + if (v == INFINITY) + return "∞"; + else if (v == -INFINITY) + return "-∞"; + else if (std::isnan(v)) + return "?"; + return string::f("%.*g", getDisplayPrecision(), math::normalizeZero(v)); } void Quantity::setDisplayValueString(std::string s) {