Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add pow1p to the docs
  • Loading branch information
mborland committed Aug 26, 2024
commit 866d9d01652138daf6f2a6b7b1e2f65f36ed89e2
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]