]> sigrok.org Git - pulseview.git/blobdiff - pv/util.cpp
util: Added a space between the value and prefix
[pulseview.git] / pv / util.cpp
index 2a04aaec7d99e68fb7ef9295c6ec4e40f5476425..2e54adeaed3dffae88cb2b7354ce9eb57395302b 100644 (file)
@@ -32,9 +32,10 @@ using namespace Qt;
 namespace pv {
 namespace util {
 
-static const QString SIPrefixes[9] =
-       {"f", "p", "n", QChar(0x03BC), "m", "", "k", "M", "G"};
-const int FirstSIPrefixPower = -15;
+static const QString SIPrefixes[17] =
+       {"y", "z", "a", "f", "p", "n", QChar(0x03BC), "m", "", "k", "M", "G",
+       "T", "P", "E", "Z", "Y"};
+const int FirstSIPrefixPower = -24;
 
 QString format_si_value(double v, QString unit, int prefix,
        unsigned int precision, bool sign)
@@ -60,8 +61,8 @@ QString format_si_value(double v, QString unit, int prefix,
        QTextStream ts(&s);
        if (sign)
                ts << forcesign;
-       ts << fixed << qSetRealNumberPrecision(precision)
-               << (v  * multiplier) << SIPrefixes[prefix] << unit;
+       ts << fixed << qSetRealNumberPrecision(precision) <<
+               (v  * multiplier) << " " << SIPrefixes[prefix] << unit;
 
        return s;
 }