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

PrevUpHomeNext

sin_pi

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

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

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

}} // namespaces

Returns the sine 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 sine of πx.

Table 6.76. Error rates for sin_pi

Microsoft Visual C++ version 12.0
Win32
double

GNU C++ version 5.1.0
linux
double

GNU C++ version 5.1.0
linux
long double

Sun compiler version 0x5130
Sun Solaris
long double

sin_pi and cos_pi

Max = 0.99ε (Mean = 0.328ε)

Max = 0ε (Mean = 0ε)

Max = 0.996ε (Mean = 0.335ε)

Max = 0.996ε (Mean = 0.336ε)

sin_pi and cos_pi near integers and half integers

Max = 0.996ε (Mean = 0.343ε)

Max = 0ε (Mean = 0ε)

Max = 0.976ε (Mean = 0.293ε)

Max = 0.976ε (Mean = 0.293ε)



PrevUpHomeNext