LLVM API Documentation

IsInf.cpp

Go to the documentation of this file.
00001 //===-- IsInf.cpp - Platform-independent wrapper around C99 isinf() -------===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file was developed by the LLVM research group and is distributed under
00006 // the University of Illinois Open Source License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 
00010 #include "llvm/Config/config.h"
00011 
00012 #if HAVE_ISINF_IN_MATH_H
00013 # include <math.h>
00014 #elif HAVE_ISINF_IN_CMATH
00015 # include <cmath>
00016 #elif HAVE_STD_ISINF_IN_CMATH
00017 # include <cmath>
00018 using std::isinf;
00019 #elif HAVE_FINITE_IN_IEEEFP_H
00020 // A handy workaround I found at http://www.unixguide.net/sun/faq ...
00021 // apparently this has been a problem with Solaris for years.
00022 # include <ieeefp.h>
00023 static int isinf(double x) { return !finite(x) && x==x; }
00024 #elif defined(_MSC_VER)
00025 #include <float.h>
00026 #define isinf(X) (!_finite(X))
00027 #elif defined(_AIX) && defined(__GNUC__)
00028 // GCC's fixincludes seems to be removing the isinf() declaration from the
00029 // system header /usr/include/math.h
00030 # include <math.h>
00031 static int isinf(double x) { return !finite(x) && x==x; }
00032 #elif defined(__hpux)
00033 // HP-UX is "special"
00034 #include <math.h>
00035 static int isinf(double x) { return ((x)==INFINITY)||((x)==-INFINITY); }
00036 #else
00037 # error "Don't know how to get isinf()"
00038 #endif
00039 
00040 namespace llvm {
00041 
00042 int IsInf (float f)  { return isinf (f); }
00043 int IsInf (double d) { return isinf (d); }
00044 
00045 }; // end namespace llvm;