From e0737c56c1e384e05064a0c6e1ac46979371041b Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Wed, 19 Dec 2018 22:58:32 +0100 Subject: New upstream version 2.0.0+repack --- .../math/doc/html/math_toolkit/powers/cbrt.html | 165 +++++++++++++ .../math/doc/html/math_toolkit/powers/cos_pi.html | 169 +++++++++++++ .../math/doc/html/math_toolkit/powers/ct_pow.html | 265 +++++++++++++++++++++ .../math/doc/html/math_toolkit/powers/expm1.html | 177 ++++++++++++++ .../math/doc/html/math_toolkit/powers/hypot.html | 91 +++++++ .../math/doc/html/math_toolkit/powers/log1p.html | 189 +++++++++++++++ .../math/doc/html/math_toolkit/powers/powm1.html | 162 +++++++++++++ .../math/doc/html/math_toolkit/powers/sin_pi.html | 169 +++++++++++++ .../doc/html/math_toolkit/powers/sqrt1pm1.html | 165 +++++++++++++ 9 files changed, 1552 insertions(+) create mode 100644 boost/libs/math/doc/html/math_toolkit/powers/cbrt.html create mode 100644 boost/libs/math/doc/html/math_toolkit/powers/cos_pi.html create mode 100644 boost/libs/math/doc/html/math_toolkit/powers/ct_pow.html create mode 100644 boost/libs/math/doc/html/math_toolkit/powers/expm1.html create mode 100644 boost/libs/math/doc/html/math_toolkit/powers/hypot.html create mode 100644 boost/libs/math/doc/html/math_toolkit/powers/log1p.html create mode 100644 boost/libs/math/doc/html/math_toolkit/powers/powm1.html create mode 100644 boost/libs/math/doc/html/math_toolkit/powers/sin_pi.html create mode 100644 boost/libs/math/doc/html/math_toolkit/powers/sqrt1pm1.html (limited to 'boost/libs/math/doc/html/math_toolkit/powers') diff --git a/boost/libs/math/doc/html/math_toolkit/powers/cbrt.html b/boost/libs/math/doc/html/math_toolkit/powers/cbrt.html new file mode 100644 index 00000000..c6c58a9f --- /dev/null +++ b/boost/libs/math/doc/html/math_toolkit/powers/cbrt.html @@ -0,0 +1,165 @@ + + + +cbrt + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+

+cbrt +

+
#include <boost/math/special_functions/cbrt.hpp>
+
+
namespace boost{ namespace math{
+
+template <class T>
+calculated-result-type cbrt(T x);
+
+template <class T, class Policy>
+calculated-result-type cbrt(T x, const Policy&);
+
+}} // namespaces
+
+

+ Returns the cubed root of x: x1/3. +

+

+ The return type of this function is computed using the result + type calculation rules: the return is double + when x is an integer type and T otherwise. +

+

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

+

+ Implemented using Halley iteration. +

+

+ The following graph illustrates the behaviour of cbrt: +

+

+ +

+
+ + Accuracy +
+

+ For built in floating-point types cbrt + should have approximately 2 epsilon accuracy. +

+
+

Table 6.80. Error rates for cbrt

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ Microsoft Visual C++ version 12.0
Win32
double +

+
+

+ GNU C++ version 5.1.0
linux
double +

+
+

+ GNU C++ version 5.1.0
linux
long double +

+
+

+ Sun compiler version 0x5130
Sun Solaris
long double +

+
+

+ cbrt Function +

+
+

+ Max = 1.7ε (Mean = 0.565ε)

+ (<math.h>: Max = 1.7ε (Mean = 0.565ε)) +

+
+

+ Max = 0ε (Mean = 0ε)

(Cephes: + Max = 0ε (Mean = 0ε)) +

+
+

+ Max = 1.34ε (Mean = 0.471ε)

+ (<tr1/cmath>: Max = 1.34ε (Mean = 0.471ε))
+ (<math.h>: Max = 1.34ε (Mean = 0.471ε)) +

+
+

+ Max = 1.11ε (Mean = 0.424ε)

+ (<math.h>: Max = 1.11ε (Mean = 0.424ε)) +

+
+
+
+ + Testing +
+

+ A mixture of spot test sanity checks, and random high precision test values + calculated using NTL::RR at 1000-bit precision. +

+
+ + + +
+
+
+PrevUpHomeNext +
+ + diff --git a/boost/libs/math/doc/html/math_toolkit/powers/cos_pi.html b/boost/libs/math/doc/html/math_toolkit/powers/cos_pi.html new file mode 100644 index 00000000..1b15f3a7 --- /dev/null +++ b/boost/libs/math/doc/html/math_toolkit/powers/cos_pi.html @@ -0,0 +1,169 @@ + + + +cos_pi + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+

+cos_pi +

+
#include <boost/math/special_functions/cos_pi.hpp>
+
+
namespace boost{ namespace math{
+
+template <class T>
+calculated-result-type cos_pi(T x);
+
+template <class T, class Policy>
+calculated-result-type cos_pi(T x, const Policy&);
+
+}} // namespaces
+
+

+ Returns the cosine of πx. +

+

+ The return type of this function is computed using the result + type calculation rules: the return is double + when x is an integer type and T otherwise. +

+

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

+

+ This function performs exact all-integer arithmetic argument reduction before + computing the cosine of πx. +

+
+

Table 6.77. Error rates for cos_pi

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ Microsoft Visual C++ version 12.0
Win32
double +

+
+

+ GNU C++ version 5.1.0
linux
double +

+
+

+ GNU C++ version 5.1.0
linux
long double +

+
+

+ Sun compiler version 0x5130
Sun Solaris
long double +

+
+

+ sin_pi and cos_pi +

+
+

+ Max = 0.996ε (Mean = 0.281ε) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.991ε (Mean = 0.302ε) +

+
+

+ Max = 0.991ε (Mean = 0.302ε) +

+
+

+ sin_pi and cos_pi near integers and half integers +

+
+

+ Max = 0.996ε (Mean = 0.298ε) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.976ε (Mean = 0.28ε) +

+
+

+ Max = 0.976ε (Mean = 0.28ε) +

+
+
+
+
+ + + +
+
+
+PrevUpHomeNext +
+ + diff --git a/boost/libs/math/doc/html/math_toolkit/powers/ct_pow.html b/boost/libs/math/doc/html/math_toolkit/powers/ct_pow.html new file mode 100644 index 00000000..cf405120 --- /dev/null +++ b/boost/libs/math/doc/html/math_toolkit/powers/ct_pow.html @@ -0,0 +1,265 @@ + + + +Compile Time Power of a Runtime Base + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+ +

+ The pow function effectively + computes the compile-time integral power of a run-time base. +

+
+ + Synopsis +
+

+ #include <boost/math/special_functions/pow.hpp> +

+
namespace boost { namespace math {
+
+template <int N, typename T>
+calculated-result-type pow(T base);
+
+template <int N, typename T, class Policy>
+calculated-result-type pow(T base, const Policy& policy);
+
+}}
+
+
+ + Rationale + and Usage +
+

+ Computing the power of a number with an exponent that is known at compile + time is a common need for programmers. In such cases, the usual method is + to avoid the overhead implied by the pow, + powf and powl + C functions by hardcoding an expression such as: +

+
// Hand-written 8th power of a 'base' variable
+double result = base*base*base*base*base*base*base*base;
+
+

+ However, this kind of expression is not really readable (knowing the value + of the exponent involves counting the number of occurrences of base), + error-prone (it's easy to forget an occurrence), syntactically bulky, and + non-optimal in terms of performance. +

+

+ The pow function of Boost.Math helps writing this kind expression along with + solving all the problems listed above: +

+
// 8th power of a 'base' variable using math::pow
+double result = pow<8>(base);
+
+

+ The expression is now shorter, easier to read, safer, and even faster. Indeed, + pow will compute the expression + such that only log2(N) products are made for a power of N. For instance in + the example above, the resulting expression will be the same as if we had + written this, with only one computation of each identical subexpression: +

+
// Internal effect of pow<8>(base)
+double result = ((base*base)*(base*base))*((base*base)*(base*base));
+
+

+ Only 3 different products were actually computed. +

+
+ + Return + Type +
+

+ The return type of these functions is computed using the result + type calculation rules. For example: +

+
    +
  • + If T is a float, the return + type is a float. +
  • +
  • + If T is a long double, + the return type is a long double. +
  • +
  • + Otherwise, the return type is a double. +
  • +
+
+ + Policies +
+

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

+
+ + Error + Handling +
+

+ Two cases of errors can occur when using pow: +

+
+

+ The default overflow error policy is throw_on_error. + A call like pow<-2>(0) will thus throw a std::overflow_error + exception. As shown in the link given above, other error handling policies + can be used: +

+
    +
  • + errno_on_error: Sets + ::errno + to ERANGE and returns + std::numeric_limits<T>::infinity(). +
  • +
  • + ignore_error: Returns + std::numeric_limits<T>::infinity(). +
  • +
  • + user_error: Returns the + result of boost::math::policies::user_overflow_error: this function + must be defined by the user. +
  • +
+

+ The default indeterminate result error policy is ignore_error, + which for this function returns 1 since it's the most commonly chosen result + for a power of 0. Here again, other error handling policies can be used: +

+
    +
  • + throw_on_error: Throws + std::domain_error +
  • +
  • + errno_on_error: Sets + ::errno + to EDOM and returns 1. +
  • +
  • + user_error: Returns the + result of boost::math::policies::user_indeterminate_result_error: this + function must be defined by the user. +
  • +
+

+ Here is an example of error handling customization where we want to specify + the result that has to be returned in case of error. We will thus use the + user_error policy, by passing + as second argument an instance of an overflow_error policy templated with + user_error: +

+
// First we open the boost::math::policies namespace and define the `user_overflow_error`
+// by making it return the value we want in case of error (-1 here)
+
+namespace boost { namespace math { namespace policies {
+template <class T>
+T user_overflow_error(const char*, const char*, const T&)
+{ return -1; }
+}}}
+
+
+// Then we invoke pow and indicate that we want to use the user_error policy
+using boost::math::policies;
+double result = pow<-5>(base, policy<overflow_error<user_error> >());
+
+// We can now test the returned value and treat the special case if needed:
+if (result == -1)
+{
+    // there was an error, do something...
+}
+
+

+ Another way is to redefine the default overflow_error + policy by using the BOOST_MATH_OVERFLOW_ERROR_POLICY macro. Once the user_overflow_error function is defined + as above, we can achieve the same result like this: +

+
// Redefine the default error_overflow policy
+#define BOOST_MATH_OVERFLOW_ERROR_POLICY user_error
+#include <boost/math/special_functions/pow.hpp>
+
+// From this point, passing a policy in argument is no longer needed, a call like this one
+// will return -1 in case of error:
+
+double result = pow<-5>(base);
+
+
+ + Acknowledgements +
+

+ Bruno Lalande submitted this addition to Boost.Math. +

+

+ Thanks to Joaquín López Muñoz and Scott McMurray for their help in +improving the implementation. +

+
+ + References +
+

+ D.E. Knuth, The Art of Computer Programming, Vol. 2: Seminumerical + Algorithms, 2nd ed., Addison-Wesley, Reading, MA, 1981 +

+
+ + + +
+
+
+PrevUpHomeNext +
+ + diff --git a/boost/libs/math/doc/html/math_toolkit/powers/expm1.html b/boost/libs/math/doc/html/math_toolkit/powers/expm1.html new file mode 100644 index 00000000..e5aa1fde --- /dev/null +++ b/boost/libs/math/doc/html/math_toolkit/powers/expm1.html @@ -0,0 +1,177 @@ + + + +expm1 + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+

+expm1 +

+
#include <boost/math/special_functions/expm1.hpp>
+
+
namespace boost{ namespace math{
+
+template <class T>
+calculated-result-type expm1(T x);
+
+template <class T, class Policy>
+calculated-result-type expm1(T x, const Policy&);
+
+}} // namespaces
+
+

+ Returns ex - 1. +

+

+ The return type of this function is computed using the result + type calculation rules: the return is double + when x is an integer type and T otherwise. +

+

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

+

+ For small x, then ex is very close to 1, as a result calculating ex - 1 results in + catastrophic cancellation errors when x is small. expm1 + calculates ex - 1 using rational approximations (for up to 128-bit long doubles), + otherwise via a series expansion when x is small (giving an accuracy of less + than 2ɛ). +

+

+ Finally when BOOST_HAS_EXPM1 is defined then the float/double/long double + specializations of this template simply forward to the platform's native + (POSIX) implementation of this function. +

+

+ The following graph illustrates the behaviour of expm1: +

+

+ +

+
+ + Accuracy +
+

+ For built in floating point types expm1 + should have approximately 1 epsilon accuracy. +

+
+

Table 6.79. Error rates for expm1

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ Microsoft Visual C++ version 12.0
Win32
double +

+
+

+ GNU C++ version 5.1.0
linux
double +

+
+

+ GNU C++ version 5.1.0
linux
long double +

+
+

+ Sun compiler version 0x5130
Sun Solaris
long double +

+
+

+ Random test data +

+
+

+ Max = 0.996ε (Mean = 0.283ε)

+ (<math.h>: Max = 1.31ε (Mean = 0.496ε)) +

+
+

+ Max = 0.793ε (Mean = 0.126ε)

+ (Rmath 3.0.2: Max = 0.793ε (Mean = 0.126ε))
+ (Cephes: Max = 1.53ε (Mean = 0.535ε)) +

+
+

+ Max = 0.992ε (Mean = 0.402ε)

+ (<tr1/cmath>: Max + = 1.26e+19ε (Mean = 4.89e+18ε) And + other failures.)
(<math.h>: + Max = 0.992ε (Mean = 0.402ε)) +

+
+

+ Max = 1.31ε (Mean = 0.406ε)

+ (<math.h>: Max = 0.996ε (Mean = 0.426ε)) +

+
+
+
+ + Testing +
+

+ A mixture of spot test sanity checks, and random high precision test values + calculated using NTL::RR at 1000-bit precision. +

+
+ + + +
+
+
+PrevUpHomeNext +
+ + diff --git a/boost/libs/math/doc/html/math_toolkit/powers/hypot.html b/boost/libs/math/doc/html/math_toolkit/powers/hypot.html new file mode 100644 index 00000000..171f221b --- /dev/null +++ b/boost/libs/math/doc/html/math_toolkit/powers/hypot.html @@ -0,0 +1,91 @@ + + + +hypot + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+

+hypot +

+
template <class T1, class T2>
+calculated-result-type hypot(T1 x, T2 y);
+
+template <class T1, class T2, class Policy>
+calculated-result-type hypot(T1 x, T2 y, const Policy&);
+
+

+ Effects: computes +in such a way + as to avoid undue underflow and overflow. +

+

+ The return type of this function is computed using the result + type calculation rules when T1 and T2 are of different + 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. +

+

+ When calculating it's quite easy for the intermediate terms to + either overflow or underflow, even though the result is in fact perfectly + representable. +

+
+ + Implementation +
+

+ The function is even and symmetric in x and y, so first take assume x,y + > 0 and x > y (we can permute the arguments + if this is not the case). +

+

+ Then if x * ε   >= y we can simply return x. +

+

+ Otherwise the result is given by: +

+

+ +

+
+ + + +
+
+
+PrevUpHomeNext +
+ + diff --git a/boost/libs/math/doc/html/math_toolkit/powers/log1p.html b/boost/libs/math/doc/html/math_toolkit/powers/log1p.html new file mode 100644 index 00000000..3587c188 --- /dev/null +++ b/boost/libs/math/doc/html/math_toolkit/powers/log1p.html @@ -0,0 +1,189 @@ + + + +log1p + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+

+log1p +

+
#include <boost/math/special_functions/log1p.hpp>
+
+
namespace boost{ namespace math{
+
+template <class T>
+calculated-result-type log1p(T x);
+
+template <class T, class Policy>
+calculated-result-type log1p(T x, const Policy&);
+
+}} // namespaces
+
+

+ Returns the natural logarithm of x+1. +

+

+ The return type of this function is computed using the result + type calculation rules: the return is double + when x is an integer type and T otherwise. +

+

+ 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 many situations where it is desirable to compute log(x+1). + However, for small x then + x+1 suffers from catastrophic cancellation errors + so that x+1 == 1 + and log(x+1) == 0, + when in fact for very small x, the best approximation to log(x+1) would be + x. log1p + calculates the best approximation to log(1+x) using + a Taylor series expansion for accuracy (less than 2ɛ). Alternatively note that + there are faster methods available, for example using the equivalence: +

+
log(1+x) == (log(1+x) * x) / ((1+x) - 1)
+
+

+ However, experience has shown that these methods tend to fail quite spectacularly + once the compiler's optimizations are turned on, consequently they are used + only when known not to break with a particular compiler. In contrast, the + series expansion method seems to be reasonably immune to optimizer-induced + errors. +

+

+ Finally when BOOST_HAS_LOG1P is defined then the float/double/long double + specializations of this template simply forward to the platform's native + (POSIX) implementation of this function. +

+

+ The following graph illustrates the behaviour of log1p: +

+

+ +

+
+ + Accuracy +
+

+ For built in floating point types log1p + should have approximately 1 epsilon accuracy. +

+
+

Table 6.78. Error rates for log1p

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ Microsoft Visual C++ version 12.0
Win32
double +

+
+

+ GNU C++ version 5.1.0
linux
double +

+
+

+ GNU C++ version 5.1.0
linux
long double +

+
+

+ Sun compiler version 0x5130
Sun Solaris
long double +

+
+

+ Random test data +

+
+

+ Max = 0.509ε (Mean = 0.057ε)

+ (<math.h>: Max = 0.509ε (Mean = 0.057ε)) +

+
+

+ Max = 0.846ε (Mean = 0.153ε)

+ (Rmath 3.0.2: Max = 0.846ε (Mean = 0.153ε))
+ (Cephes: Max = 0.799ε (Mean = 0.122ε)) +

+
+

+ Max = 0.818ε (Mean = 0.227ε)

+ (<tr1/cmath>: Max = 0.818ε (Mean = 0.227ε))
+ (<math.h>: Max = 0.818ε (Mean = 0.227ε)) +

+
+

+ Max = 1.53ε (Mean = 0.627ε)

+ (<math.h>: Max = 0.818ε (Mean = 0.249ε)) +

+
+
+
+ + Testing +
+

+ A mixture of spot test sanity checks, and random high precision test values + calculated using NTL::RR at 1000-bit precision. +

+
+ + + +
+
+
+PrevUpHomeNext +
+ + diff --git a/boost/libs/math/doc/html/math_toolkit/powers/powm1.html b/boost/libs/math/doc/html/math_toolkit/powers/powm1.html new file mode 100644 index 00000000..81094d45 --- /dev/null +++ b/boost/libs/math/doc/html/math_toolkit/powers/powm1.html @@ -0,0 +1,162 @@ + + + +powm1 + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+

+powm1 +

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

+

+ The following graph illustrates the behaviour of powm1: +

+

+ +

+
+ + Accuracy +
+

+ Should have approximately 2-3 epsilon accuracy. +

+
+

Table 6.82. Error rates for powm1

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ Microsoft Visual C++ version 12.0
Win32
double +

+
+

+ GNU C++ version 5.1.0
linux
double +

+
+

+ GNU C++ version 5.1.0
linux
long double +

+
+

+ Sun compiler version 0x5130
Sun Solaris
long double +

+
+

+ powm1 +

+
+

+ Max = 1.99ε (Mean = 0.461ε) +

+
+

+ Max = 1.26ε (Mean = 0.428ε) +

+
+

+ Max = 2.04ε (Mean = 0.521ε) +

+
+

+ Max = 2.14ε (Mean = 0.498ε) +

+
+
+
+ + Testing +
+

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

+
+ + + +
+
+
+PrevUpHomeNext +
+ + diff --git a/boost/libs/math/doc/html/math_toolkit/powers/sin_pi.html b/boost/libs/math/doc/html/math_toolkit/powers/sin_pi.html new file mode 100644 index 00000000..d9c50871 --- /dev/null +++ b/boost/libs/math/doc/html/math_toolkit/powers/sin_pi.html @@ -0,0 +1,169 @@ + + + +sin_pi + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+

+sin_pi +

+
#include <boost/math/special_functions/sin_pi.hpp>
+
+
namespace boost{ namespace math{
+
+template <class T>
+calculated-result-type sin_pi(T x);
+
+template <class T, class Policy>
+calculated-result-type sin_pi(T x, const Policy&);
+
+}} // namespaces
+
+

+ Returns the sine of πx. +

+

+ The return type of this function is computed using the result + type calculation rules: the return is double + when x is an integer type and T otherwise. +

+

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

+

+ This function performs exact all-integer arithmetic argument reduction before + computing the sine of πx. +

+
+

Table 6.76. Error rates for sin_pi

+
+++++++ + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ Microsoft Visual C++ version 12.0
Win32
double +

+
+

+ GNU C++ version 5.1.0
linux
double +

+
+

+ GNU C++ version 5.1.0
linux
long double +

+
+

+ Sun compiler version 0x5130
Sun Solaris
long double +

+
+

+ sin_pi and cos_pi +

+
+

+ Max = 0.99ε (Mean = 0.328ε) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.996ε (Mean = 0.335ε) +

+
+

+ Max = 0.996ε (Mean = 0.336ε) +

+
+

+ sin_pi and cos_pi near integers and half integers +

+
+

+ Max = 0.996ε (Mean = 0.343ε) +

+
+

+ Max = 0ε (Mean = 0ε) +

+
+

+ Max = 0.976ε (Mean = 0.293ε) +

+
+

+ Max = 0.976ε (Mean = 0.293ε) +

+
+
+
+
+ + + +
+
+
+PrevUpHomeNext +
+ + diff --git a/boost/libs/math/doc/html/math_toolkit/powers/sqrt1pm1.html b/boost/libs/math/doc/html/math_toolkit/powers/sqrt1pm1.html new file mode 100644 index 00000000..09e3a6b2 --- /dev/null +++ b/boost/libs/math/doc/html/math_toolkit/powers/sqrt1pm1.html @@ -0,0 +1,165 @@ + + + +sqrt1pm1 + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+ +
#include <boost/math/special_functions/sqrt1pm1.hpp>
+
+
namespace boost{ namespace math{
+
+template <class T>
+calculated-result-type sqrt1pm1(T x);
+
+template <class T, class Policy>
+calculated-result-type sqrt1pm1(T x, const Policy&);
+
+}} // namespaces
+
+

+ Returns sqrt(1+x) - 1. +

+

+ The return type of this function is computed using the result + type calculation rules: the return is double + when x is an integer type and T otherwise. +

+

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

+

+ This function is useful when you need the difference between sqrt(x) and + 1, when x is itself close to 1. +

+

+ Implemented in terms of log1p + and expm1. +

+

+ The following graph illustrates the behaviour of sqrt1pm1: +

+

+ +

+
+ + Accuracy +
+

+ For built in floating-point types sqrt1pm1 + should have approximately 3 epsilon accuracy. +

+
+

Table 6.81. Error rates for sqrt1pm1

+
+++++++ + + + + + + + + + + + + + + +
+ +

+ Microsoft Visual C++ version 12.0
Win32
double +

+
+

+ GNU C++ version 5.1.0
linux
double +

+
+

+ GNU C++ version 5.1.0
linux
long double +

+
+

+ Sun compiler version 0x5130
Sun Solaris
long double +

+
+

+ sqrt1pm1 +

+
+

+ Max = 1.36ε (Mean = 0.44ε) +

+
+

+ Max = 1.3ε (Mean = 0.404ε) +

+
+

+ Max = 1.33ε (Mean = 0.409ε) +

+
+

+ Max = 1.54ε (Mean = 0.568ε) +

+
+
+
+ + Testing +
+

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

+
+ + + +
+
+
+PrevUpHomeNext +
+ + -- cgit v1.2.3