1 //===-- IsInf.cpp - Platform-independent wrapper around C99 isinf() -------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Platform-independent wrapper around C99 isinf()
12 //===----------------------------------------------------------------------===//
14 #include "llvm/Config/config.h"
16 #if HAVE_ISINF_IN_MATH_H
18 #elif HAVE_ISINF_IN_CMATH
20 #elif HAVE_STD_ISINF_IN_CMATH
23 #elif HAVE_FINITE_IN_IEEEFP_H
24 // A handy workaround I found at http://www.unixguide.net/sun/faq ...
25 // apparently this has been a problem with Solaris for years.
27 static int isinf(double x
) { return !finite(x
) && x
==x
; }
28 #elif defined(_MSC_VER)
30 #define isinf(X) (!_finite(X))
31 #elif defined(_AIX) && defined(__GNUC__)
32 // GCC's fixincludes seems to be removing the isinf() declaration from the
33 // system header /usr/include/math.h
35 static int isinf(double x
) { return !finite(x
) && x
==x
; }
39 static int isinf(double x
) { return ((x
) == INFINITY
) || ((x
) == -INFINITY
); }
41 # error "Don't know how to get isinf()"
46 int IsInf(float f
) { return isinf(f
); }
47 int IsInf(double d
) { return isinf(d
); }
49 } // end namespace llvm;