summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qlocale_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qlocale_p.h')
-rw-r--r--src/corelib/tools/qlocale_p.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h
index a9c23aed61..a96ecf1c1c 100644
--- a/src/corelib/tools/qlocale_p.h
+++ b/src/corelib/tools/qlocale_p.h
@@ -249,7 +249,16 @@ public:
if (std::fabs(d) > std::numeric_limits<float>::max()) {
if (ok != 0)
*ok = false;
- return 0.0f;
+ const float huge = std::numeric_limits<float>::infinity();
+ return d < 0 ? -huge : huge;
+ }
+ if (std::fabs(d) >= std::numeric_limits<double>::min() // i.e. d != 0
+ && std::fabs(d) < std::numeric_limits<float>::min()) {
+ // Values smaller than std::numeric_limits<double>::min() have
+ // failed already; match them.
+ if (ok != 0)
+ *ok = false;
+ return 0;
}
return float(d);
}