diff options
| author | Edward Welbourne <edward.welbourne@qt.io> | 2025-06-02 14:20:50 +0200 |
|---|---|---|
| committer | Edward Welbourne <edward.welbourne@qt.io> | 2025-06-04 16:30:32 +0200 |
| commit | 9be6e51a501dfbee1c058616b9e81b1731640e3e (patch) | |
| tree | 2eb1fd2a7fbd3627931dfbf505ccbf47e39e4a25 /src/corelib/serialization/qjsonvalue.cpp | |
| parent | 65365e9bb796c9921441bdb20655cf8224ee1b8b (diff) | |
Update QJsonValue(qint64) docs to reflect full precision
Amends commit 35adb74ddd915831789f0175423660f8e898942e (from 5.15) to
reflect the improved precision of 64-bit int when stored as a JSON
value.
Task-number: QTBUG-28560
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I07915bc190dd7696e58356143e8857f91e888c67
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/serialization/qjsonvalue.cpp')
| -rw-r--r-- | src/corelib/serialization/qjsonvalue.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/corelib/serialization/qjsonvalue.cpp b/src/corelib/serialization/qjsonvalue.cpp index e358f18bde7..5d2e71b903d 100644 --- a/src/corelib/serialization/qjsonvalue.cpp +++ b/src/corelib/serialization/qjsonvalue.cpp @@ -175,9 +175,14 @@ QJsonValue::QJsonValue(int v) /*! \overload Creates a value of type Double, with value \a v. - NOTE: the integer limits for IEEE 754 double precision data is 2^53 (-9007199254740992 to +9007199254740992). - If you pass in values outside this range expect a loss of precision to occur. - */ + + This is stored internally as a 64-bit integer, so retains its full + precision, as long as it is retrieved with \l toInteger(). However, + retrieving its value with \l toDouble() will lose precision unless the value + lies between ±2^53. + + \sa toInteger(), toDouble() +*/ QJsonValue::QJsonValue(qint64 v) : value(v) { |
