From 52b42cfa1021edba7a71f47a7c537f24790b9ff5 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 25 Oct 2016 08:50:14 -0400 Subject: Fix up the double-precision calculation of equations within parentheses. Now (3*(1/3)) properly equals 1 instead of 0.9999999 --- src-qt5/desktop-utils/lumina-calculator/mainUI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src-qt5/desktop-utils') diff --git a/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp b/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp index 1ea925cd..b26acb73 100644 --- a/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp +++ b/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp @@ -143,7 +143,7 @@ double mainUI::strToNumber(QString str){ //qDebug() << "Replace value:" << str << start << end << str.mid(start+1,end-start); double tmp = strToNumber( str.mid(start+1, end-start-1)); if(tmp!=tmp){ return BADVALUE; } //not a number - str.replace(start, end-start+1, QString::number( tmp ) ); + str.replace(start, end-start+1, QString::number( tmp, 'e', 16) ); //need as high precision as possible here - internal only, never seen //qDebug() << "Replaced:" << str; } // ------------------------------------- -- cgit