Skip to content

Commit

Permalink
Add pow1p to the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mborland committed Aug 19, 2024
1 parent 3dd720d commit d48cd68
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/math.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ and use the function's name as the link text.]
[def __sqrt1pm1 [link math_toolkit.powers.sqrt1pm1 sqrt1pm1]]
[def __rsqrt [link math_toolkit.powers.rsqrt rsqrt]]
[def __powm1 [link math_toolkit.powers.powm1 powm1]]
[def __pow1p [link math_toolkit.powers.pow1p pow1p]]
[def __hypot [link math_toolkit.powers.hypot hypot]]
[def __pow [link math_toolkit.powers.ct_pow pow]]

Expand Down
34 changes: 34 additions & 0 deletions doc/sf/pow1p.qbk
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[/
Copyright Matt Borland 2024
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt).
]

[section:pow1p pow1p]

[h4 Synopsis]

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

namespace boost {
namespace math {

template <typename T1, typename T2, typename Policy>
BOOST_MATH_GPU_ENABLED tools::promote_args_t<T1, T2>
pow1p(const T1 x, const T2 y, const Policy& pol)

template <typename T1, typename T2>
BOOST_MATH_GPU_ENABLED tools::promote_args_t<T1, T2>
pow1p(const T1 x, const T2 y)

}} // namespaces


The function `pow1p` computes (1 + x)[super y ] where x and y are real numbers.
This function is particularly useful for scenarios where adding 1 to x before raising it to the power of y is required.
It provides a more numerically stable and efficient way to perform this computation, especially for small values of x.
When x is very small, directly computing (1 + x)[super y ] using standard arithmetic operations can lead to a loss of precision due to floating-point arithmetic limitations.
The pow1p function helps mitigate this issue by internally handling such cases more accurately.

[endsect]

0 comments on commit d48cd68

Please sign in to comment.