mardi 2 octobre 2018

Precision of QJsonValue::toDouble() is too low

I have:

const auto data = "{\"lat\": 63.772132536}";

When I parse this:

QJsonParseError parseError;
QJsonDocument document = QJsonDocument::fromJson(data.toUtf8(), &parseError);
QJsonObject root = document.object();
const double latitude = root.value("lat").toDouble();

The value is rounded to 63.7721. As this is a GPS coordinate it's not OK. How can I get more precision?

The data is coming from gpsd so I cannot change that.

Aucun commentaire:

Enregistrer un commentaire