qt5base-lts/tests/auto/corelib/kernel/qvariant
Thiago Macieira 8153386397 Enhance precision of the FP conversion to strings in QVariant
This now guarantees that doing a round-trip from an FP number to string
and back to number results in the same number. This change is required
because DBL_DIG and FLT_DIG don't have the meaning that we were
expecting them to, here: they mean the minimum number of digits of
precision in decimal (i.e., changing the last decimal will always cause
the FP number to change). We need the maximum number: there is one
change in the last decimal place that causes the FP number to change.

IEEE 754 single-precision has 24 binary digits and double precision has
53 binary digits in their mantissa. To convert that to decimal, multiply
by the number of decimal digits a binary digit represents (log2(10) =
0.3), then add one for the rounding and one more digit for the actual
precision we want. That is, for floats we now ask for 9 digits and for
double, 17 decimal digits.

Task-number: QTBUG-42574
Change-Id: Ic78beb60a218f75322f832d33d63fd84e7a65b65
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2014-11-20 05:46:18 +01:00
..
stream Split the QGuiVariant test from the Core one. 2012-07-25 00:48:33 +02:00
.gitignore Moving relevant tests to corelib/kernel 2011-09-01 12:42:14 +02:00
qvariant.pro Set the Qt API level to compatibility mode in all tests. 2012-08-01 15:37:46 +02:00
qvariant.qrc Cleanup mess in public type ids. 2012-01-25 21:08:08 +01:00
tst_qvariant.cpp Enhance precision of the FP conversion to strings in QVariant 2014-11-20 05:46:18 +01:00