mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 07:35:48 +08:00
Avoid scientific notation in fraction part
This commit is contained in:
committed by
Mat Sutcliffe
parent
2736539b49
commit
e5205bef1f
@@ -141,7 +141,8 @@ namespace BlackMisc
|
||||
{
|
||||
double intpart;
|
||||
const double fractpart = modf(value, &intpart);
|
||||
const QString f = QString::number(fractpart);
|
||||
const int prec = width >= 0 ? width + 1 : 10;
|
||||
const QString f = QString::number(fractpart, 'f', prec); // avoid scientific notation
|
||||
const QString fInt = f.length() < 3 ? QString("0") : f.mid(2);
|
||||
if (width < 0) { return fInt; }
|
||||
if (fInt.length() >= width) { return fInt.left(width); }
|
||||
|
||||
Reference in New Issue
Block a user