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:
@@ -72,6 +72,10 @@ test-suite examples :
|
||||
[ run legendre_stieltjes_example.cpp : : : [ requires cxx11_auto_declarations cxx11_defaulted_functions cxx11_lambdas ] ]
|
||||
#[ # run inverse_chi_squared_find_df_example.cpp ]
|
||||
[ run lambert_w_basic_example.cpp ]
|
||||
#[ run lambert_w_basic_example.cpp : : : [ requires cxx11_numeric_limits ] ]
|
||||
[ run lambert_w_simple_examples.cpp : : : [ requires cxx11_numeric_limits ] ]
|
||||
[ run lambert_w_precision_example.cpp : : : [ requires cxx11_numeric_limits ] ]
|
||||
|
||||
|
||||
[ run inverse_gamma_example.cpp ]
|
||||
[ run inverse_gamma_distribution_example.cpp : : : <exception-handling>off:<build>no ]
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -259,11 +259,6 @@ Lambert W (10.0000000) = 1.74552800
|
||||
}
|
||||
} // int main()
|
||||
|
||||
/*
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user