Print this page




  87  *      we regard r * 0 is 0 except when r is a NaN.
  88  */
  89 /* INDENT ON */
  90 
  91 #include "libm.h"       /* atan2/exp/fabs/hypot/log/pow/scalbn */
  92                         /* atan2pi/exp2/sincos/sincospi/__k_clog_r/__k_atan2 */
  93 #include "complex_wrapper.h"
  94 
  95 extern void sincospi(double, double *, double *);
  96 
  97 static const double
  98         huge = 1e300,
  99         tiny = 1e-300,
 100         invln2 = 1.44269504088896338700e+00,
 101         ln2hi = 6.93147180369123816490e-01,   /* 0x3fe62e42, 0xfee00000 */
 102         ln2lo = 1.90821492927058770002e-10,   /* 0x3dea39ef, 0x35793c76 */
 103         one = 1.0,
 104         zero = 0.0;
 105 
 106 static const int hiinf = 0x7ff00000;
 107 double atan2pi(double, double);
 108 
 109 /*
 110  * Assuming |t[0]| > |t[1]| and |t[2]| > |t[3]|, sum4fp subroutine
 111  * compute t[0] + t[1] + t[2] + t[3] into two double fp numbers.
 112  */
 113 static double
 114 sum4fp(double ta[], double *w) {
 115         double t1, t2, t3, t4, w1, w2, t;
 116         t1 = ta[0]; t2 = ta[1]; t3 = ta[2]; t4 = ta[3];
 117         /*
 118          * Rearrange ti so that |t1| >= |t2| >= |t3| >= |t4|
 119          */
 120         if (fabs(t4) > fabs(t1)) {
 121                 t = t1; t1 = t3; t3 = t;
 122                 t = t2; t2 = t4; t4 = t;
 123         } else if (fabs(t3) > fabs(t1)) {
 124                 t = t1; t1 = t3;
 125                 if (fabs(t4) > fabs(t2)) {
 126                         t3 = t4; t4 = t2; t2 = t;
 127                 } else {




  87  *      we regard r * 0 is 0 except when r is a NaN.
  88  */
  89 /* INDENT ON */
  90 
  91 #include "libm.h"       /* atan2/exp/fabs/hypot/log/pow/scalbn */
  92                         /* atan2pi/exp2/sincos/sincospi/__k_clog_r/__k_atan2 */
  93 #include "complex_wrapper.h"
  94 
  95 extern void sincospi(double, double *, double *);
  96 
  97 static const double
  98         huge = 1e300,
  99         tiny = 1e-300,
 100         invln2 = 1.44269504088896338700e+00,
 101         ln2hi = 6.93147180369123816490e-01,   /* 0x3fe62e42, 0xfee00000 */
 102         ln2lo = 1.90821492927058770002e-10,   /* 0x3dea39ef, 0x35793c76 */
 103         one = 1.0,
 104         zero = 0.0;
 105 
 106 static const int hiinf = 0x7ff00000;
 107 extern double atan2pi(double, double);
 108 
 109 /*
 110  * Assuming |t[0]| > |t[1]| and |t[2]| > |t[3]|, sum4fp subroutine
 111  * compute t[0] + t[1] + t[2] + t[3] into two double fp numbers.
 112  */
 113 static double
 114 sum4fp(double ta[], double *w) {
 115         double t1, t2, t3, t4, w1, w2, t;
 116         t1 = ta[0]; t2 = ta[1]; t3 = ta[2]; t4 = ta[3];
 117         /*
 118          * Rearrange ti so that |t1| >= |t2| >= |t3| >= |t4|
 119          */
 120         if (fabs(t4) > fabs(t1)) {
 121                 t = t1; t1 = t3; t3 = t;
 122                 t = t2; t2 = t4; t4 = t;
 123         } else if (fabs(t3) > fabs(t1)) {
 124                 t = t1; t1 = t3;
 125                 if (fabs(t4) > fabs(t2)) {
 126                         t3 = t4; t4 = t2; t2 = t;
 127                 } else {