From 95858559bb025be07e07a8a0cf4a206811a8992f Mon Sep 17 00:00:00 2001 From: Mathew Sutcliffe Date: Mon, 16 Sep 2013 23:15:11 +0100 Subject: [PATCH] fixed bug in CMath::round(), was using qRound() instead of qRound64(), which caused wrong answers when fractional part was 10 digits or more --- src/blackmisc/mathematics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/blackmisc/mathematics.cpp b/src/blackmisc/mathematics.cpp index 8e5b86646..0dd1bed84 100644 --- a/src/blackmisc/mathematics.cpp +++ b/src/blackmisc/mathematics.cpp @@ -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; }