2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-19 04:22:09 +00:00

Added two more lambert_w examples and requires cxx_numeric_limits

This commit is contained in:
pabristow
2018-10-09 12:53:11 +01:00
parent ea42a834cc
commit 20067e75e5
3 changed files with 24 additions and 19 deletions

View File

@@ -4,6 +4,10 @@
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
// Example of most basic call of both lambert W functions.
// Only requires C++03
// (and optionally a call of max_digits10 to show precision).
#include <boost/math/special_functions/lambert_w.hpp> // For lambert_w0 and wm1 functions.
#include <iostream>
@@ -14,8 +18,10 @@ int main()
double z = 2.0;
double w0 = boost::math::lambert_w0(z);
std::cout.setf(std::ios_base::showpoint); // Include any trailing zeros.
// std::cout.precision(std::numeric_limits<double>::max_digits10); // Show all possibly significant digits.
// Avoid using max_digfigs10 so as many old compilers can run the most basic lambert_w0 test.
std::cout.precision(std::numeric_limits<double>::max_digits10); // Show all possibly significant digits.
// Avoid using max_digfigs10 so as many old compilers can run the most basic lambert_w0 test?
// Require to get max_digits10
// [ run lambert_w_basic_example.cpp : : : [ requires cxx11_numeric_limits ] ]
std::cout << " lambert_w0(" << z << ") = " << w0 << std::endl; // lambert_w0(2.00000) = 0.852606
z = -0.2;
double wm1 = boost::math::lambert_wm1(z);