fixed bug in CMath::round(),

was using qRound() instead of qRound64(),
which caused wrong answers when fractional part was 10 digits or more
This commit is contained in:
Mathew Sutcliffe
2013-09-16 23:15:11 +01:00
parent 8844774fbe
commit 95858559bb

View File

@@ -45,7 +45,7 @@ double CMath::round(double value, int digits)
fractpart = modf(value, &intpart);
if (fractpart == 0) return value; // do not mess any "integers" to the worse
double m = pow(10.0, digits);
qint64 ri = qRound(value * m); // do not loose any range here
qint64 ri = qRound64(value * m); // do not loose any range here
double rv = double(ri) / m;
return rv;
}