Chris@16: /*============================================================================= Chris@16: Copyright (c) 2001-2011 Joel de Guzman Chris@16: Copyright (c) 2001-2011 Hartmut Kaiser Chris@16: http://spirit.sourceforge.net/ Chris@16: Chris@16: Distributed under the Boost Software License, Version 1.0. (See accompanying Chris@16: file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: =============================================================================*/ Chris@16: #if !defined(SPIRIT_SIGN_MAR_11_2009_0734PM) Chris@16: #define SPIRIT_SIGN_MAR_11_2009_0734PM Chris@16: Chris@16: #if defined(_MSC_VER) Chris@16: #pragma once Chris@16: #endif Chris@16: Chris@16: #include Chris@16: #include Chris@16: #if BOOST_VERSION < 104000 Chris@16: #include Chris@16: #include Chris@16: #else Chris@16: #include Chris@16: #include Chris@16: #endif Chris@16: Chris@16: namespace boost { namespace spirit { namespace detail Chris@16: { Chris@16: #if BOOST_VERSION < 104000 Chris@16: // signbit(-NAN) is broken for versions of Boost earlier than 1.40.0 Chris@16: // This routine has been taken and adapted from Johan Rade's fp_traits Chris@16: // library Chris@16: template Chris@16: inline bool (signbit)(T x) Chris@16: { Chris@16: return (boost::spirit::math::signbit)(x); Chris@16: } Chris@16: Chris@16: template Chris@16: inline T (changesign)(T x) Chris@16: { Chris@16: return (boost::spirit::math::changesign)(x); Chris@16: } Chris@16: #else Chris@16: template Chris@16: inline bool (signbit)(T x) Chris@16: { Chris@16: return (boost::math::signbit)(x) ? true : false; Chris@16: } Chris@16: Chris@16: // This routine has been taken and adapted from Johan Rade's fp_traits Chris@16: // library Chris@16: template Chris@16: inline T (changesign)(T x) Chris@16: { Chris@16: #if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && !defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY) Chris@16: return -x; Chris@16: #else Chris@16: typedef typename math::detail::fp_traits::type traits_type; Chris@16: Chris@16: typename traits_type::bits a; Chris@16: traits_type::get_bits(x, a); Chris@16: a ^= traits_type::sign; Chris@16: traits_type::set_bits(x, a); Chris@16: return x; Chris@16: #endif Chris@16: } Chris@16: #endif Chris@16: Chris@16: }}} Chris@16: Chris@16: #endif