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 --- boost/libs/math/doc/html/math_toolkit/macros.html | 88 +++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 boost/libs/math/doc/html/math_toolkit/macros.html (limited to 'boost/libs/math/doc/html/math_toolkit/macros.html') diff --git a/boost/libs/math/doc/html/math_toolkit/macros.html b/boost/libs/math/doc/html/math_toolkit/macros.html new file mode 100644 index 00000000..0200f285 --- /dev/null +++ b/boost/libs/math/doc/html/math_toolkit/macros.html @@ -0,0 +1,88 @@ + + + +Floating-Point Constant Macros + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+ +

+ All macros of the type BOOST_FLOAT16_C, BOOST_FLOAT32_C, BOOST_FLOAT64_C, BOOST_FLOAT80_C, BOOST_FLOAT128_C, and BOOST_FLOATMAX_C + are always defined after inclusion of <boost/cstdfloat.hpp>. +

+

+ These allow floating-point constants of at least the + specified width to be declared: +

+
// Declare Archimedes' constant using float32_t with approximately 7 decimal digits of precision.
+static const boost::float32_t pi = BOOST_FLOAT32_C(3.1415926536);
+
+// Declare the Euler-gamma constant with approximately 15 decimal digits of precision.
+static const boost::float64_t euler =
+   BOOST_FLOAT64_C(0.57721566490153286060651209008240243104216);
+
+// Declare the Golden Ratio constant with the maximum decimal digits of precision that the platform supports.
+static const boost::floatmax_t golden_ratio =
+   BOOST_FLOATMAX_C(1.61803398874989484820458683436563811772);
+
+
+ + + + + +
[Tip]Tip

+ Boost.Math provides many constants 'built-in', so always use Boost.Math constants + if available, for example: +

+
// Display the constant pi to the maximum available precision.
+  boost::floatmax_t pi_max = boost::math::constants::pi<boost::floatmax_t>();
+  std::cout.precision(std::numeric_limits<boost::floatmax_t>::digits10);
+  std::cout << "Most precise pi = "  << pi_max << std::endl;
+// If floatmax_t is float_128_t, then
+// Most precise pi = 3.141592653589793238462643383279503
+
+

+ from cstdfloat_example.cpp. +

+

+ See the complete list of constants. +

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