1/* $Id: CoinFinite.cpp 1448 2011-06-19 15:34:41Z stefan $ */
2// Copyright (C) 2011, International Business Machines
3// Corporation and others. All Rights Reserved.
4// This code is licensed under the terms of the Eclipse Public License (EPL).
5
6#include "CoinFinite.hpp"
7#include "CoinUtilsConfig.h"
8
9#ifdef HAVE_CFLOAT
10# include <cfloat>
11#else
12# ifdef HAVE_FLOAT_H
13# include <float.h>
14# endif
15#endif
16
17#ifdef HAVE_CMATH
18# include <cmath>
19#else
20# ifdef HAVE_MATH_H
21# include <math.h>
22# endif
23#endif
24
25#ifdef HAVE_CIEEEFP
26# include <cieeefp>
27#else
28# ifdef HAVE_IEEEFP_H
29# include <ieeefp.h>
30# endif
31#endif
32
33bool CoinFinite(double val)
34{
35#ifdef COIN_C_FINITE
36 return COIN_C_FINITE(val)!=0;
37#else
38 return val != DBL_MAX && val != -DBL_MAX;
39#endif
40}
41
42bool CoinIsnan(double val)
43{
44#ifdef COIN_C_ISNAN
45 return COIN_C_ISNAN(val)!=0;
46#else
47 return false;
48#endif
49}
50