diff --git a/src/corelib/tools/qlocale_tools.cpp b/src/corelib/tools/qlocale_tools.cpp index 4d969a4723f..a315356a23d 100644 --- a/src/corelib/tools/qlocale_tools.cpp +++ b/src/corelib/tools/qlocale_tools.cpp @@ -350,7 +350,7 @@ double asciiToDouble(const char *num, int numLen, bool &ok, int &processed, ok = false; for (int i = 0; i < processed; ++i) { char c = num[i]; - if ((c < '0' || c > '9') && c != '.' && c != '-' && c != '+' && c != 'e') { + if ((c < '0' || c > '9') && c != '.' && c != '-' && c != '+' && c != 'e' && c != 'E') { // Garbage found processed = 0; return 0.0; diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index b8f1cc568a5..fd37a03b8e1 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -693,6 +693,8 @@ void tst_QLocale::toReal_data() QTest::newRow("C 1.234e-10") << QString("C") << QString("1.234e-10") << true << 1.234e-10; QTest::newRow("C 1.234E10") << QString("C") << QString("1.234E10") << true << 1.234e10; QTest::newRow("C 1e10") << QString("C") << QString("1e10") << true << 1.0e10; + QTest::newRow("C 1e310") << QString("C") << QString("1e310") << false << std::numeric_limits::infinity(); + QTest::newRow("C 1E310") << QString("C") << QString("1E310") << false << std::numeric_limits::infinity(); QTest::newRow("C 1") << QString("C") << QString(" 1") << true << 1.0; QTest::newRow("C 1") << QString("C") << QString(" 1") << true << 1.0; QTest::newRow("C 1 ") << QString("C") << QString("1 ") << true << 1.0;