Skip to content

Commit 6c99164

Browse files
committed
Send double parameters with full precision
Sometimes doubles must be transferred with more digits than the Qt default of 6. This increases the number of transmitted digits to the maximum reasonable value (DBL_DIG).
1 parent f8b87f0 commit 6c99164

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

maiaObject.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
*/
2828

2929
#include "maiaObject.h"
30+
#include <cfloat>
3031

3132
MaiaObject::MaiaObject(QObject* parent) : QObject(parent){
3233
QDomImplementation::setInvalidDataPolicy(QDomImplementation::DropInvalidChars);
@@ -63,7 +64,7 @@ QDomElement MaiaObject::toXml(QVariant arg) {
6364
} case QVariant::Double: {
6465

6566
QDomElement tagDouble = doc.createElement("double");
66-
QDomText textDouble = doc.createTextNode(QString::number(arg.toDouble()));
67+
QDomText textDouble = doc.createTextNode(QString::number(arg.toDouble(), 'g', DBL_DIG));
6768

6869
tagValue.appendChild(tagDouble);
6970
tagDouble.appendChild(textDouble);

0 commit comments

Comments
 (0)