mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 06:45:37 +08:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user