Boost C++ Libraries 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 to view this page for the latest version.


#include <boost/math/special_functions/cos_pi.hpp>
namespace boost{ namespace math{

template <class T>
calculated-result-type cos_pi(T x);

template <class T, class Policy>
calculated-result-type cos_pi(T x, const Policy&);

}} // namespaces

Returns the cosine of πx.

The return type of this function is computed using the result type calculation rules: the return is double when x is an integer type and T otherwise.

The final Policy argument is optional and can be used to control the behaviour of the function: how it handles errors, what level of precision to use etc. Refer to the policy documentation for more details.

This function performs exact all-integer arithmetic argument reduction before computing the cosine of πx.