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