00001 #ifndef _HTL_LIMITS_H_
00002 #define _HTL_LIMITS_H_ 1
00003
00004 #include "HTL/HTL_std.h"
00005
00006 #include "math.h"
00007
00008 #if defined (__GNUG__) || defined (__GNUC__)
00009 #if defined(__STRICT_ANSI__)
00010 #if !defined (_GNU_SOURCE) && !defined (_BSD_SOURCE)
00011
00012 extern "C" {
00013 int isnan(double);
00014 int finite(double);
00015 }
00016 #endif
00017 #endif
00018 #endif
00019
00020 #if defined (WIN32)
00021 #include <float.h>
00022 #define HTL_FINITE(x) _finite(x)
00023 #define HTL_NAN(x) _isnan(x)
00024 #else
00025 #define HTL_FINITE(x) finite(x)
00026 #define HTL_NAN(x) isnan(x)
00027 #endif
00028
00029
00030
00031 #ifndef OO_DDL_TRANSLATION
00032 #if defined(__sun)
00033 #if !defined (__STDC__) &&__SUNPRO_CC >= 0x500
00034 #define __STDC__
00035 #endif
00036 #include <ieeefp.h>
00037 #endif
00038 #endif
00039
00045 class HTLlimits {
00046 public:
00048 static bool isFinite (double x) {
00049 return (HTL_FINITE(x) != 0);
00050 }
00052 static void classify (double x) {
00053 if (!isFinite(x)) {
00054 if (HTL_NAN(x) != 0)
00055 HTL_ERR("NaN skipped")
00056 else
00057 HTL_ERR("Infinite number skipped");
00058 }
00059 }
00060 };
00061
00062 #undef HTL_FINITE
00063 #undef HTL_NAN
00064
00065 #endif //_HTL_LIMITS_H_
00066