111
111
typedef typename detail::fp_traits<T>::type traits;
112
112
typedef typename traits::method method;
113
typedef typename boost::is_floating_point<T>::type fp_tag;
114
return detail::signbit_impl(x, method());
113
// typedef typename boost::is_floating_point<T>::type fp_tag;
114
typedef typename tools::promote_args<T>::type result_type;
115
return detail::signbit_impl(static_cast<result_type>(x), method());
117
118
template <class T>
120
121
return (z == 0) ? 0 : (boost::math::signbit)(z) ? -1 : 1;
123
template<class T> T (changesign)(const T& x)
124
template <class T> typename tools::promote_args<T>::type (changesign)(const T& x)
124
125
{ //!< \brief return unchanged binary pattern of x, except for change of sign bit.
125
126
typedef typename detail::fp_traits<T>::sign_change_type traits;
126
127
typedef typename traits::method method;
127
typedef typename boost::is_floating_point<T>::type fp_tag;
128
// typedef typename boost::is_floating_point<T>::type fp_tag;
129
typedef typename tools::promote_args<T>::type result_type;
129
return detail::changesign_impl(x, method());
131
return detail::changesign_impl(static_cast<result_type>(x), method());
133
inline T copysign BOOST_NO_MACRO_EXPAND(const T& x, const T& y)
134
template <class T, class U>
135
inline typename tools::promote_args<T, U>::type
136
copysign BOOST_NO_MACRO_EXPAND(const T& x, const U& y)
135
138
BOOST_MATH_STD_USING
136
return (boost::math::signbit)(x) != (boost::math::signbit)(y) ? (boost::math::changesign)(x) : x;
139
typedef typename tools::promote_args<T, U>::type result_type;
140
return (boost::math::signbit)(static_cast<result_type>(x)) != (boost::math::signbit)(static_cast<result_type>(y))
141
? (boost::math::changesign)(static_cast<result_type>(x)) : static_cast<result_type>(x);
139
144
} // namespace math