Core: IsInf

git-svn-id: svn://ultimatepp.org/upp/trunk@6790 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-01-18 14:44:03 +00:00
parent 3cf643fa79
commit c29c7ad9fa
2 changed files with 15 additions and 5 deletions

View file

@ -330,14 +330,22 @@ typedef long long unsigned uint64;
typedef uint64 qword;
#ifdef PLATFORM_WIN32
inline bool IsNaN(double d) { return findarg(_fpclass(d), _FPCLASS_QNAN, _FPCLASS_SNAN) >= 0; }
inline bool IsInf(double d) { return findarg(_fpclass(d), _FPCLASS_PINF, _FPCLASS_NINF) >= 0; }
#ifdef COMPILER_MINGW
inline bool IsNaN(double d) { return std::isnan(d); }
inline bool IsInf(double d) { return std::isinf(d); }
#else
inline bool IsNaN(double d) { return fpclassify(d) == FP_NAN; }
inline bool IsInf(double d) { return fpclassify(d) == FP_INFINITY; }
inline bool IsNaN(double d) { return _isnan(d); }
inline bool IsInf(double d) { return _finite(d) && !_isnan(d); }
#endif
#elif __APPLE__
inline bool IsNaN(double d) { return std::isnan(d); }
inline bool IsInf(double d) { return std::isinf(d); }
#else
inline bool IsNaN(double d) { return isnan(d); }
inline bool IsInf(double d) { return isinf(d); }
#endif
inline bool IsFin(double d) { return !IsNaN(d) && !IsInf(d); }
inline bool IsFin(double d) { return !IsNaN(d) && !IsInf(d); }
#ifdef COMPILER_MSC
#define I64(c) ((int64)COMBINE(c, i64))

View file

@ -1,5 +1,7 @@
//#BLITZ_PROHIBIT
// This file is explicitly removed from BLITZ to avoid inline optimizations
#ifndef flagNONAMESPACE
namespace Upp {
#endif