Boost C++ Libraries Home Libraries People FAQ More



#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.


Should have approximately 2-3 epsilon accuracy.


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