From 866d9d01652138daf6f2a6b7b1e2f65f36ed89e2 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 19 Aug 2024 13:54:56 -0400 Subject: [PATCH] Add pow1p to the docs --- doc/math.qbk | 1 + doc/sf/pow1p.qbk | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 doc/sf/pow1p.qbk diff --git a/doc/math.qbk b/doc/math.qbk index d6b90efb0b..67375da114 100644 --- a/doc/math.qbk +++ b/doc/math.qbk @@ -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]] diff --git a/doc/sf/pow1p.qbk b/doc/sf/pow1p.qbk new file mode 100644 index 0000000000..a2201d77ae --- /dev/null +++ b/doc/sf/pow1p.qbk @@ -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 + + namespace boost { + namespace math { + + template + BOOST_MATH_GPU_ENABLED tools::promote_args_t + pow1p(const T1 x, const T2 y, const Policy& pol) + + template + BOOST_MATH_GPU_ENABLED tools::promote_args_t + 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]