$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r85333 - trunk/boost/multiprecision/detail/functions
From: john_at_[hidden]
Date: 2013-08-13 13:05:54
Author: johnmaddock
Date: 2013-08-13 13:05:54 EDT (Tue, 13 Aug 2013)
New Revision: 85333
URL: http://svn.boost.org/trac/boost/changeset/85333
Log:
Modify cosine default evaluation code to call the sin code: less code and better precision.
Text files modified: 
   trunk/boost/multiprecision/detail/functions/trig.hpp |    44 +++------------------------------------ 
   1 files changed, 4 insertions(+), 40 deletions(-)
Modified: trunk/boost/multiprecision/detail/functions/trig.hpp
==============================================================================
--- trunk/boost/multiprecision/detail/functions/trig.hpp	Tue Aug 13 09:40:57 2013	(r85332)
+++ trunk/boost/multiprecision/detail/functions/trig.hpp	2013-08-13 13:05:54 EDT (Tue, 13 Aug 2013)	(r85333)
@@ -292,10 +292,8 @@
    const bool b_zero    = eval_get_sign(xx) == 0;
    const bool b_pi_half = com == 0;
 
-   // Check if the reduced argument is very close to 0 or pi/2.
-   const bool    b_near_zero    = xx.compare(fp_type(1e-4)) < 0;
-   eval_subtract(t, xx);
-   const bool    b_near_pi_half = t.compare(fp_type(1e-4)) < 0;
+   // Check if the reduced argument is very close to 0.
+   const bool    b_near_zero    = xx.compare(fp_type(1e-1)) < 0;
 
    if(b_zero)
    {
@@ -313,44 +311,10 @@
       hyp0F1(result, n_pi, t);
       BOOST_MATH_INSTRUMENT_CODE(result.str(0, std::ios_base::scientific));
    }
-   else if(b_near_pi_half)
-   {
-      T t2(t);
-      eval_multiply(t, t);
-      eval_divide(t, si_type(-4));
-      n_pi = fp_type(1.5f);
-      hyp0F1(result, n_pi, t);
-      eval_multiply(result, t2);
-      BOOST_MATH_INSTRUMENT_CODE(result.str(0, std::ios_base::scientific));
-   }
    else
    {
-      // Scale to a small argument for an efficient Taylor series,
-      // implemented as a hypergeometric function. Use a standard
-      // divide by three identity a certain number of times.
-      // Here we use division by 3^9 --> (19683 = 3^9).
-
-      static const ui_type n_scale           = 9;
-      static const ui_type n_three_pow_scale = 19683;
-      eval_divide(xx, n_three_pow_scale);
-
-      eval_multiply(t, xx, xx);
-      eval_divide(t, si_type(-4));
-      n_pi = fp_type(0.5f);
-
-      // Now with small arguments, we are ready for a series expansion.
-      hyp0F1(result, n_pi, t);
-      BOOST_MATH_INSTRUMENT_CODE(result.str(0, std::ios_base::scientific));
-
-      // Convert back using multiple angle identity.
-      for(ui_type k = 0; k < n_scale; k++)
-      {
-         eval_multiply(t, result, result);
-         eval_multiply(t, result);
-         eval_multiply(t, ui_type(4));
-         eval_multiply(result, si_type(-3));
-         eval_add(result, t);
-      }
+      eval_subtract(t, xx);
+      eval_sin(result, t);
    }
    if(b_negate_cos)
       result.negate();