Ticket #13531: sign.hpp.txt

File sign.hpp.txt, 1.3 KB (added by Rangasamy <rangasamy@…>, 5 years ago)
Line 
1#ifdef __GNUC__
2#pragma GCC system_header
3#endif
4/*=============================================================================
5 Copyright (c) 2001-2014 Joel de Guzman
6 Copyright (c) 2001-2011 Hartmut Kaiser
7 http://spirit.sourceforge.net/
8
9 Distributed under the Boost Software License, Version 1.0. (See accompanying
10 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11=============================================================================*/
12#if !defined(SPIRIT_SIGN_MAR_11_2009_0734PM)
13#define SPIRIT_SIGN_MAR_11_2009_0734PM
14
15#include <boost/config/no_tr1/cmath.hpp>
16#include <boost/math/special_functions/fpclassify.hpp>
17#include <boost/math/special_functions/sign.hpp>
18
19namespace snps_boost_1_63_0 {} namespace boost = snps_boost_1_63_0; namespace snps_boost_1_63_0 { namespace spirit { namespace x3
20{
21 template<typename T>
22 inline bool (signbit)(T x)
23 {
24 return (snps_boost_1_63_0::math::signbit)(x) ? true : false;
25 }
26
27 // This routine has been taken and adapted from Johan Rade's fp_traits
28 // library
29 template<typename T>
30 inline T (changesign)(T x)
31 {
32#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && !defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY)
33 return -x;
34#else
35 return (boost::math::changesign)(x);
36#endif
37 }
38
39}}}
40
41#endif