diff --git a/templates/lib/util.cpp b/templates/lib/util.cpp index 504674a7..a0381c59 100644 --- a/templates/lib/util.cpp +++ b/templates/lib/util.cpp @@ -23,6 +23,7 @@ #include "metaenumvariable_p.h" #include "metatype.h" +#include #include QString Grantlee::unescapeStringLiteral(const QString &input) @@ -212,7 +213,13 @@ std::pair Grantlee::calcFileSize(qreal size, int unitSystem, bool found = false; int count = 0; const qreal baseVal = (_unitSystem == 10) ? 1000.0F : 1024.0F; +#if FLT_EVAL_METHOD == 2 + // Avoid that this is treated as long double, as the increased + // precision breaks the comparison below. + volatile qreal current = 1.0F; +#else qreal current = 1.0F; +#endi int units = decimalUnits.size(); while (!found && (count < units)) { current *= baseVal;