Browse Source

Use infinity symbol for Quantity display string instead of "inf".

tags/v2.0.0
Andrew Belt 4 years ago
parent
commit
4ba2e0f219
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      src/Quantity.cpp

+ 8
- 1
src/Quantity.cpp View File

@@ -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) {


Loading…
Cancel
Save