Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

powm1

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

template <class T1, class T2>
calculated-result-type powm1(T1 x, T2 y);

template <class T1, class T2, class Policy>
calculated-result-type powm1(T1 x, T2 y, const Policy&);

}} // namespaces

Returns xy - 1.

The return type of this function is computed using the result type calculation rules when T1 and T2 are dufferent types.

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.

There are two domains where this is useful: when y is very small, or when x is close to 1.

Implemented in terms of expm1.

The following graph illustrates the behaviour of powm1:

Accuracy

Should have approximately 2-3 epsilon accuracy.

Table 6.82. Error rates for powm1

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

powm1

Max = 1.99ε (Mean = 0.461ε)

Max = 1.26ε (Mean = 0.428ε)

Max = 2.04ε (Mean = 0.521ε)

Max = 2.14ε (Mean = 0.498ε)


Testing

A selection of random high precision test values calculated using NTL::RR at 1000-bit precision.


PrevUpHomeNext