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"
11 #include "llvm/System/IncludeFile.h"
13 #if HAVE_ISINF_IN_MATH_H
15 #elif HAVE_ISINF_IN_CMATH
17 #elif HAVE_STD_ISINF_IN_CMATH
20 #elif HAVE_FINITE_IN_IEEEFP_H
21 // A handy workaround I found at http://www.unixguide.net/sun/faq ...
22 // apparently this has been a problem with Solaris for years.
24 static int isinf(double x
) { return !finite(x
) && x
==x
; }
25 #elif defined(_MSC_VER)
27 #define isinf(X) (!_finite(X))
28 #elif defined(_AIX) && defined(__GNUC__)
29 // GCC's fixincludes seems to be removing the isinf() declaration from the
30 // system header /usr/include/math.h
32 static int isinf(double x
) { return !finite(x
) && x
==x
; }
36 static int isinf(double x
) { return ((x
)==INFINITY
)||((x
)==-INFINITY
); }
38 # error "Don't know how to get isinf()"
43 int IsInf (float f
) { return isinf (f
); }
44 int IsInf (double d
) { return isinf (d
); }
46 } // end namespace llvm;
48 DEFINING_FILE_FOR(SupportIsInf
)