blob: 7fd857e931bde83336d4e6a1893c9188ab20298b [file] [log] [blame]
Brian Gaeke418f73c2004-07-21 03:13:50 +00001//===-- IsInf.cpp ---------------------------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
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.
7//
8//===----------------------------------------------------------------------===//
9//
10// Platform-independent wrapper around C99 isinf().
11//
12//===----------------------------------------------------------------------===//
13
14#include "Config/config.h"
15#if HAVE_ISINF_IN_MATH_H
16# include <math.h>
17#elif HAVE_ISINF_IN_CMATH
18# include <cmath>
19#elif HAVE_STD_ISINF_IN_CMATH
20# include <cmath>
21using std::isinf;
Brian Gaeke0d3ac4c2004-07-21 03:32:51 +000022#elif HAVE_FINITE_IN_IEEEFP_H
23// A handy workaround I found at http://www.unixguide.net/sun/faq ...
24// apparently this has been a problem with Solaris for years.
25# include <ieeefp.h>
26static int isinf(double x) { return !finite(x) && x==x; }
Brian Gaeke418f73c2004-07-21 03:13:50 +000027#else
28# error "Don't know how to get isinf()"
29#endif
30
31namespace llvm {
32
33int IsInf (float f) { return isinf (f); }
34int IsInf (double d) { return isinf (d); }
35
36}; // end namespace llvm;