blob: bdfdfbf3155dad820f42fef2fdd53d133dff92d2 [file] [log] [blame]
Brian Gaeke30135b22004-06-22 23:54:38 +00001//===-- IsNAN.cpp ---------------------------------------------------------===//
Misha Brukmanf976c852005-04-21 22:55:34 +00002//
Brian Gaeke30135b22004-06-22 23:54:38 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Misha Brukmanf976c852005-04-21 22:55:34 +00007//
Brian Gaeke30135b22004-06-22 23:54:38 +00008//===----------------------------------------------------------------------===//
9//
Misha Brukmanf976c852005-04-21 22:55:34 +000010// Platform-independent wrapper around C99 isnan().
Brian Gaeke30135b22004-06-22 23:54:38 +000011//
12//===----------------------------------------------------------------------===//
13
Reid Spencer551ccae2004-09-01 22:55:40 +000014#include "llvm/Config/config.h"
Reid Spencer7107c3b2006-07-26 16:18:00 +000015
Brian Gaeke30135b22004-06-22 23:54:38 +000016#if HAVE_ISNAN_IN_MATH_H
17# include <math.h>
18#elif HAVE_ISNAN_IN_CMATH
19# include <cmath>
20#elif HAVE_STD_ISNAN_IN_CMATH
21# include <cmath>
22using std::isnan;
Chris Lattner67b6e4e2004-10-25 18:46:05 +000023#elif defined(_MSC_VER)
24#include <float.h>
25#define isnan _isnan
Brian Gaeke30135b22004-06-22 23:54:38 +000026#else
27# error "Don't know how to get isnan()"
28#endif
29
30namespace llvm {
Chris Lattnerf42d1dd2006-08-11 23:52:54 +000031 int IsNAN(float f) { return isnan(f); }
32 int IsNAN(double d) { return isnan(d); }
Chris Lattnerd74ea2b2006-05-24 17:04:05 +000033} // end namespace llvm;