Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / multiprecision / example / mpfr_precision.cpp
index 9138b60..eb559cb 100644 (file)
@@ -5,13 +5,13 @@
 
 //[mpfr_variable
 
-/*` 
+/*`
 This example illustrates the use of variable-precision arithmetic with
 the `mpfr_float` number type.  We'll calculate the median of the
 beta distribution to an absurdly high precision and compare the
 accuracy and times taken for various methods.  That is, we want
 to calculate the value of `x` for which ['I[sub x](a, b) = 0.5].
+
 Ultimately we'll use Newtons method and set the precision of
 mpfr_float to have just enough digits at each iteration.
 
@@ -110,7 +110,7 @@ full working precision of the arguments throughout.  Our reference function take
 
 We begin by setting the default working precision to that requested, and then, since we don't know where
 our arguments `a` and `b` have been or what precision they have, we make a copy of them - note that since
-copying also copies the precision as well as the value, we have to set the precision expicitly with a 
+copying also copies the precision as well as the value, we have to set the precision expicitly with a
 second argument to the copy.  Then we can simply return the result of `ibeta_inv`:
 */
 mpfr_float beta_distribution_median_method_1(mpfr_float const& a_, mpfr_float const& b_, unsigned digits10)
@@ -167,9 +167,9 @@ Method 2 time = 0.646746
 Relative error: 7.55843e-1501
 ]
 
-Clearly they are both equally accurate, but Method 1 is actually faster and our plan for improved performance 
+Clearly they are both equally accurate, but Method 1 is actually faster and our plan for improved performance
 hasn't actually worked.  It turns out that we're not actually comparing like with like, because `ibeta_inv` uses
-Halley iteration internally which churns out more digits of precision rather more rapidly than Newton iteration.  
+Halley iteration internally which churns out more digits of precision rather more rapidly than Newton iteration.
 So the time we save by refining an initial `double` approximation, then loose it again by taking more iterations
 to get to the result.
 
@@ -188,7 +188,7 @@ mpfr_float beta_distribution_median_method_3(mpfr_float const& a_, mpfr_float co
    while (current_digits < digits10)
    {
       current_digits *= 2;
-      scoped_precision sp(std::min(current_digits, digits10));
+      scoped_precision sp((std::min)(current_digits, digits10));
       mpfr_float a(a_, mpfr_float::default_precision()), b(b_, mpfr_float::default_precision());
       guess.precision(mpfr_float::default_precision());
       f = boost::math::detail::ibeta_imp(a, b, guess, boost::math::policies::policy<>(), false, true, &f1) - 0.5f;