diff --git a/uppsrc/Core/parser.cpp b/uppsrc/Core/parser.cpp index 17f30a84d..3d1aa7d85 100644 --- a/uppsrc/Core/parser.cpp +++ b/uppsrc/Core/parser.cpp @@ -236,10 +236,11 @@ uint64 CParser::ReadNumber64(int base) throw(Error) double CParser::ReadDouble() throw(Error) { LTIMING("ReadDouble"); -#ifdef PLATFORM_POSIX -#ifdef FE_OVERFLOW - feclearexcept(FE_OVERFLOW); +#ifdef PLARFORM_WIN32 + _clearfp(); #endif +#if defined(PLATFORM_POSIX) && defined(FE_OVERFLOW) + feclearexcept(FE_OVERFLOW); #endif int sign = Sgn(); if(!IsDigit(*term)) @@ -258,11 +259,15 @@ double CParser::ReadDouble() throw(Error) n *= pow(10.0, ReadInt()); DoSpaces(); n = sign * n; -#ifdef PLATFORM_POSIX -#ifdef FE_OVERFLOW - if(fetestexcept(FE_OVERFLOW)) +#ifdef PLATFORM_WIN32 + if(_clearfp() & SW_OVERFLOW) ThrowError("number is too big"); #endif +#if defined(PLATFORM_POSIX) && defined(FE_OVERFLOW) + if(fetestexcept(FE_OVERFLOW)) { + ThrowError("number is too big"); + feclearexcept(FE_OVERFLOW); + } #endif return n; }