// (C) Copyright John Maddock 2006. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_MATH_TOOLS_SIGN_HPP #define BOOST_MATH_TOOLS_SIGN_HPP #include #include namespace boost{ namespace math{ template inline int sign BOOST_NO_MACRO_EXPAND(const T& z) { return (z == 0) ? 0 : (z < 0) ? -1 : 1; } template inline int signbit BOOST_NO_MACRO_EXPAND(const T& z) { return (z < 0) ? 1 : 0; } template inline T copysign BOOST_NO_MACRO_EXPAND(const T& x, const T& y) { BOOST_MATH_STD_USING return fabs(x) * boost::math::sign(y); } } // namespace math } // namespace boost #endif // BOOST_MATH_TOOLS_SIGN_HPP