Index: runners/calculator/calculatorrunner.cpp =================================================================== --- runners/calculator/calculatorrunner.cpp +++ runners/calculator/calculatorrunner.cpp @@ -313,10 +313,8 @@ } //ECMAScript has issues with the last digit in simple rational computations - //This script rounds off the last digit; see bug 167986 - QString roundedResultString = eng.evaluate(QStringLiteral("var exponent = 14-(1+Math.floor(Math.log(Math.abs(result))/Math.log(10)));\ - var order=Math.pow(10,exponent);\ - (order > 0? Math.round(result*order)/order : 0)")).toString(); + //This script rounds to 7 of 15 digits; see bug 167986. Divide by 1 to omit trailing zeros: + QString roundedResultString = eng.evaluate(QStringLiteral("result.toPrecision(7)/1")).toString(); roundedResultString.replace('.', QLocale().decimalPoint(), Qt::CaseInsensitive);