Skip to content

Commit 433d52a

Browse files
author
Paweł Salawa
committed
#5450 Increased precision for very small decimal numbers (like 1e-15).
1 parent 2752e64 commit 433d52a

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
### 3.4.19
44
- BUGFIX: #5447 Database object filtering improved - both speed (3x) and reliability (i.e. typing while filtering is in progress).
5+
- BUGFIX: #5450 Increased precision for very small decimal numbers (like 1e-15).
56
- BUGFIX: Fixed manual updates checking in case when automatic on-startup checking is disabled.
67

78
### 3.4.18

SQLiteStudio3/coreSQLiteStudio/common/utils.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -966,14 +966,16 @@ QStringList concat(const QList<QStringList>& list)
966966

967967
QString doubleToString(const QVariant& val)
968968
{
969-
QString str = val.toString();
970-
if (str.contains("e") || str.midRef(str.indexOf('.') + 1).length() > 14)
971-
{
972-
str = QString::number(val.toDouble(), 'f', 14).remove(QRegExp("0*$"));
973-
if (str.endsWith("."))
974-
str += "0";
975-
}
976-
else if (!str.contains('.'))
969+
double d = val.toDouble();
970+
QString str = QString::number(d, 'f', 17);
971+
972+
while (str.contains('.') && str.endsWith('0'))
973+
str.chop(1);
974+
975+
if (str.endsWith('.'))
976+
str.chop(1);
977+
978+
if (!str.contains('.'))
977979
str += ".0";
978980

979981
return str;

0 commit comments

Comments
 (0)