I have made code below. i want correct value as 44112.25895 but result value is 44112.3 how can i fix this issue?
QJsonObject qj{ {"close", 44112.25895} };
qDebug() << qj;
QJsonValue qjv = qj.value("close");
qDebug() << qjv;
qDebug() << qjv.toDouble();
result is
QJsonObject({"close":44112.25895})
QJsonValue(double, 44112.3)
44112.3
As indicated by chehrlic in the comments, the default precision of qDebug() is not what you want. The Qt documentation says that the default precision is 6 digits.
You can adjust it using qSetRealNumberPrecision, like this:
If you want to set this precision only once, then you can define your own qDebug, such as:
and use it like this: