Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Sign Manipulation Functions

Synopsis

#include <boost/math/special_functions/sign.hpp>

namespace boost{ namespace math{

template<class T> 
int signbit(T x);

template <class T>
inline int sign (const T& z);

template <class T>
inline T copysign (const T& x, const T& y);

}} // namespaces
Description
template<class T> 
int signbit(T x);

Returns a non-zero value if the sign bit is set in variable x, otherwise 0.

template <class T>
inline int sign (const T& z);

Returns 1 if x > 0, -1 if x < 0, and 0 if x is zero.

template <class T>
inline T copysign (const T& x, const T& y);

Sets the sign of x to be the same as the sign of y.


PrevUpHomeNext