1 /*=============================================================================
2 Copyright (c) 2001-2014 Joel de Guzman
3 Copyright (c) 2001-2011 Hartmut Kaiser
4 http://spirit.sourceforge.net/
6 Distributed under the Boost Software License, Version 1.0. (See accompanying
7 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 =============================================================================*/
9 #if !defined(BOOST_SPIRIT_X3_SIGN_MAR_11_2009_0734PM)
10 #define BOOST_SPIRIT_X3_SIGN_MAR_11_2009_0734PM
12 #include <boost/config/no_tr1/cmath.hpp>
13 #include <boost/math/special_functions/fpclassify.hpp>
14 #include <boost/math/special_functions/sign.hpp>
16 namespace boost { namespace spirit { namespace x3
19 inline bool (signbit)(T x)
21 return (boost::math::signbit)(x) ? true : false;
24 // This routine has been taken and adapted from Johan Rade's fp_traits
27 inline T (changesign)(T x)
29 #if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && !defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY)
32 typedef typename math::detail::fp_traits<T>::type traits_type;
34 typename traits_type::bits a;
35 traits_type::get_bits(x, a);
36 a ^= traits_type::sign;
37 traits_type::set_bits(x, a);