diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2018-11-19 19:53:38 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2018-11-23 10:05:24 +0000 |
commit | ce159d1a3e48308d54300560f024e8501c1395c9 (patch) | |
tree | 5893e5b235738b6abfb6352d6cdf5f1f2e9cada9 /tests/auto/network/socket/qtcpsocket | |
parent | a9923674030980706940b3ee11145c38674bb35d (diff) |
Fix toFloat()s between float and double ranges and document
Revised some toFloat()s to be consistent with the matching
toDouble()s; previously, they would return infinity if toDouble() did
but return 0 if toDouble() got a finite value outside float's range.
That also applied to values that underflowed float's range, succeeding
and returning 0 as long as they were within double's range but failing
if toDouble() underflowed. Now float-underflow also fails. Amended
their documentation to reflect this more consistent reality.
Added some tests of out-of-range values, infinities and NaNs.
[ChangeLog][QtCore][toFloat] QString, QByteArray and QLocale returned
an infinity on double-overflow (since 5.7) but returned 0 on a finite
double outside float's range, while setting ok to false; this was at
odds with their documented behavior of returning 0 on any failure.
They also succeeded, returning zero, on underflow of float's range,
unless double underflowed, where they failed. Changed the handling of
values outside float's range to match that of values outside double's
range: fail, returning an infinity on overflow or zero on underflow.
The documentation now reflects the revised behavior, which matches
toDouble().
Change-Id: Ia168bcacf7def0df924840d45d8edc5f850449d6
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/network/socket/qtcpsocket')
0 files changed, 0 insertions, 0 deletions