force NaN not infinity on windows (consistent with std and other platforms)

This commit is contained in:
Alex Fabijanic 2018-06-05 00:42:40 -05:00
parent 232b1610de
commit d02294a67f
2 changed files with 7 additions and 0 deletions

View File

@ -92,18 +92,21 @@ private:
//
inline bool FPEnvironmentImpl::isInfiniteImpl(float value)
{
if (_isnan(value) != 0) return false;
return _finite(value) == 0;
}
inline bool FPEnvironmentImpl::isInfiniteImpl(double value)
{
if (_isnan(value) != 0) return false;
return _finite(value) == 0;
}
inline bool FPEnvironmentImpl::isInfiniteImpl(long double value)
{
if (_isnan(value) != 0) return false;
return _finite(value) == 0;
}

View File

@ -605,6 +605,7 @@ void StringTest::testStringToFloat()
assertTrue (FPEnvironment::isNaN(strToFloat("infinity")));
assertTrue (!FPEnvironment::isNaN(strToFloat("infinity", "infinity")));
assertTrue (!FPEnvironment::isNaN(strToFloat("-infinity", "infinity")));
assertTrue (!FPEnvironment::isNaN(strToFloat("1.23")));
assertTrue (FPEnvironment::isNaN(strToFloat("Inf")));
assertTrue (!FPEnvironment::isNaN(strToFloat("Inf", "Inf")));
@ -612,6 +613,7 @@ void StringTest::testStringToFloat()
assertTrue (FPEnvironment::isInfinite(strToFloat("-inf")));
assertTrue (FPEnvironment::isInfinite(strToFloat("infinity", "infinity")));
assertTrue (FPEnvironment::isInfinite(strToFloat("-infinity", "infinity")));
assertTrue (!FPEnvironment::isInfinite(strToFloat("1.23")));
assertTrue (!FPEnvironment::isInfinite(strToFloat("abc")));
assertTrue (FPEnvironment::isInfinite(strToFloat("Inf", "Inf")));
}
@ -763,6 +765,7 @@ void StringTest::testStringToDouble()
assertTrue (FPEnvironment::isNaN(strToDouble("infinity")));
assertTrue (!FPEnvironment::isNaN(strToDouble("infinity", "infinity")));
assertTrue (!FPEnvironment::isNaN(strToDouble("-infinity", "infinity")));
assertTrue (!FPEnvironment::isNaN(strToDouble("1.23")));
assertTrue (FPEnvironment::isNaN(strToDouble("Inf")));
assertTrue (!FPEnvironment::isNaN(strToDouble("Inf", "Inf")));
@ -770,6 +773,7 @@ void StringTest::testStringToDouble()
assertTrue (FPEnvironment::isInfinite(strToDouble("-inf")));
assertTrue (FPEnvironment::isInfinite(strToDouble("infinity", "infinity")));
assertTrue (FPEnvironment::isInfinite(strToDouble("-infinity", "infinity")));
assertTrue (!FPEnvironment::isInfinite(strToDouble("1.23")));
assertTrue (!FPEnvironment::isInfinite(strToDouble("abc")));
assertTrue (FPEnvironment::isInfinite(strToDouble("Inf", "Inf")));
}