Skip to content

Commit d48cd68

Browse files
committed
Add pow1p to the docs
1 parent 3dd720d commit d48cd68

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

Diff for: doc/math.qbk

+1
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ and use the function's name as the link text.]
313313
[def __sqrt1pm1 [link math_toolkit.powers.sqrt1pm1 sqrt1pm1]]
314314
[def __rsqrt [link math_toolkit.powers.rsqrt rsqrt]]
315315
[def __powm1 [link math_toolkit.powers.powm1 powm1]]
316+
[def __pow1p [link math_toolkit.powers.pow1p pow1p]]
316317
[def __hypot [link math_toolkit.powers.hypot hypot]]
317318
[def __pow [link math_toolkit.powers.ct_pow pow]]
318319

Diff for: doc/sf/pow1p.qbk

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[/
2+
Copyright Matt Borland 2024
3+
Distributed under the Boost Software License, Version 1.0.
4+
(See accompanying file LICENSE_1_0.txt or copy at
5+
http://www.boost.org/LICENSE_1_0.txt).
6+
]
7+
8+
[section:pow1p pow1p]
9+
10+
[h4 Synopsis]
11+
12+
#include <boost/math/special_functions/pow1p.hpp>
13+
14+
namespace boost {
15+
namespace math {
16+
17+
template <typename T1, typename T2, typename Policy>
18+
BOOST_MATH_GPU_ENABLED tools::promote_args_t<T1, T2>
19+
pow1p(const T1 x, const T2 y, const Policy& pol)
20+
21+
template <typename T1, typename T2>
22+
BOOST_MATH_GPU_ENABLED tools::promote_args_t<T1, T2>
23+
pow1p(const T1 x, const T2 y)
24+
25+
}} // namespaces
26+
27+
28+
The function `pow1p` computes (1 + x)[super y ] where x and y are real numbers.
29+
This function is particularly useful for scenarios where adding 1 to x before raising it to the power of y is required.
30+
It provides a more numerically stable and efficient way to perform this computation, especially for small values of x.
31+
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.
32+
The pow1p function helps mitigate this issue by internally handling such cases more accurately.
33+
34+
[endsect]

0 commit comments

Comments
 (0)