Chris@16
|
1 /*=============================================================================
|
Chris@16
|
2 Copyright (c) 2010 Bryce Lelbach
|
Chris@16
|
3
|
Chris@16
|
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
6 =============================================================================*/
|
Chris@16
|
7
|
Chris@16
|
8 #include <boost/config.hpp>
|
Chris@16
|
9
|
Chris@16
|
10 #if defined(BOOST_NO_FENV_H)
|
Chris@16
|
11 #error This platform does not have a floating point environment
|
Chris@16
|
12 #endif
|
Chris@16
|
13
|
Chris@16
|
14 #if !defined(BOOST_DETAIL_FENV_HPP)
|
Chris@16
|
15 #define BOOST_DETAIL_FENV_HPP
|
Chris@16
|
16
|
Chris@16
|
17 /* If we're using clang + glibc, we have to get hacky.
|
Chris@16
|
18 * See http://llvm.org/bugs/show_bug.cgi?id=6907 */
|
Chris@16
|
19 #if defined(__clang__) && (__clang_major__ < 3) && \
|
Chris@16
|
20 defined(__GNU_LIBRARY__) && /* up to version 5 */ \
|
Chris@16
|
21 defined(__GLIBC__) && /* version 6 + */ \
|
Chris@16
|
22 !defined(_FENV_H)
|
Chris@16
|
23 #define _FENV_H
|
Chris@16
|
24
|
Chris@16
|
25 #include <features.h>
|
Chris@16
|
26 #include <bits/fenv.h>
|
Chris@16
|
27
|
Chris@16
|
28 extern "C" {
|
Chris@16
|
29 extern int fegetexceptflag (fexcept_t*, int) __THROW;
|
Chris@16
|
30 extern int fesetexceptflag (__const fexcept_t*, int) __THROW;
|
Chris@16
|
31 extern int feclearexcept (int) __THROW;
|
Chris@16
|
32 extern int feraiseexcept (int) __THROW;
|
Chris@16
|
33 extern int fetestexcept (int) __THROW;
|
Chris@16
|
34 extern int fegetround (void) __THROW;
|
Chris@16
|
35 extern int fesetround (int) __THROW;
|
Chris@16
|
36 extern int fegetenv (fenv_t*) __THROW;
|
Chris@16
|
37 extern int fesetenv (__const fenv_t*) __THROW;
|
Chris@16
|
38 extern int feupdateenv (__const fenv_t*) __THROW;
|
Chris@16
|
39 extern int feholdexcept (fenv_t*) __THROW;
|
Chris@16
|
40
|
Chris@16
|
41 #ifdef __USE_GNU
|
Chris@16
|
42 extern int feenableexcept (int) __THROW;
|
Chris@16
|
43 extern int fedisableexcept (int) __THROW;
|
Chris@16
|
44 extern int fegetexcept (void) __THROW;
|
Chris@16
|
45 #endif
|
Chris@16
|
46 }
|
Chris@16
|
47
|
Chris@16
|
48 namespace std { namespace tr1 {
|
Chris@16
|
49 using ::fenv_t;
|
Chris@16
|
50 using ::fexcept_t;
|
Chris@16
|
51 using ::fegetexceptflag;
|
Chris@16
|
52 using ::fesetexceptflag;
|
Chris@16
|
53 using ::feclearexcept;
|
Chris@16
|
54 using ::feraiseexcept;
|
Chris@16
|
55 using ::fetestexcept;
|
Chris@16
|
56 using ::fegetround;
|
Chris@16
|
57 using ::fesetround;
|
Chris@16
|
58 using ::fegetenv;
|
Chris@16
|
59 using ::fesetenv;
|
Chris@16
|
60 using ::feupdateenv;
|
Chris@16
|
61 using ::feholdexcept;
|
Chris@16
|
62 } }
|
Chris@16
|
63
|
Chris@16
|
64 #else /* if we're not using GNU's C stdlib, fenv.h should work with clang */
|
Chris@16
|
65 #if defined(__SUNPRO_CC) /* lol suncc */
|
Chris@16
|
66 #include <stdio.h>
|
Chris@16
|
67 #endif
|
Chris@16
|
68
|
Chris@16
|
69 #include <fenv.h>
|
Chris@16
|
70
|
Chris@16
|
71 #endif
|
Chris@16
|
72
|
Chris@16
|
73 #endif /* BOOST_DETAIL_FENV_HPP */
|
Chris@16
|
74
|