Brian Gaeke | 418f73c | 2004-07-21 03:13:50 +0000 | [diff] [blame] | 1 | //===-- 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> |
| 21 | using std::isinf; |
Brian Gaeke | 0d3ac4c | 2004-07-21 03:32:51 +0000 | [diff] [blame^] | 22 | #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> |
| 26 | static int isinf(double x) { return !finite(x) && x==x; } |
Brian Gaeke | 418f73c | 2004-07-21 03:13:50 +0000 | [diff] [blame] | 27 | #else |
| 28 | # error "Don't know how to get isinf()" |
| 29 | #endif |
| 30 | |
| 31 | namespace llvm { |
| 32 | |
| 33 | int IsInf (float f) { return isinf (f); } |
| 34 | int IsInf (double d) { return isinf (d); } |
| 35 | |
| 36 | }; // end namespace llvm; |