Print this page
11210 libm should be cstyle(1ONBLD) clean

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libm/common/Q/__rem_pio2l.c
          +++ new/usr/src/lib/libm/common/Q/__rem_pio2l.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  24   24   */
       25 +
  25   26  /*
  26   27   * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  27   28   * Use is subject to license terms.
  28   29   */
  29   30  
  30   31  /*
  31   32   * __rem_pio2l(x,y)
  32   33   *
  33   34   * return the remainder of x rem pi/2 in y[0]+y[1] by calling __rem_pio2m
  34   35   */
  35   36  
  36   37  #ifndef FDLIBM_BASED
  37   38  #include "libm.h"
       39 +
  38   40  extern int __rem_pio2m(double *, double *, int, int, int, const int *);
  39      -#else                           /* FDLIBM_BASED */
       41 +#else /* FDLIBM_BASED */
  40   42  #include "fdlibm.h"
  41   43  #define __rem_pio2m     __kernel_rem_pio2
  42      -#endif                          /* FDLIBM_BASED */
       44 +#endif /* FDLIBM_BASED */
  43   45  
  44   46  #include "longdouble.h"
  45   47  
  46   48  extern const int _TBL_ipio2l_inf[];
  47      -
  48      -static const long double
  49      -        two24l = 16777216.0L,
  50      -        pio4   = 0.7853981633974483096156608458198757210495L;
       49 +static const long double two24l = 16777216.0L,
       50 +        pio4 = 0.7853981633974483096156608458198757210495L;
  51   51  
  52   52  int
  53   53  __rem_pio2l(long double x, long double *y)
  54   54  {
  55   55          long double z, w;
  56   56          double t[5], v[5];
  57   57          int e0, i, nx, n, sign;
  58   58          const int *ipio2;
  59   59  
  60   60          sign = signbitl(x);
  61   61          z = fabsl(x);
       62 +
  62   63          if (z <= pio4) {
  63   64                  y[0] = x;
  64   65                  y[1] = 0;
  65   66                  return (0);
  66   67          }
       68 +
  67   69          e0 = ilogbl(z) - 23;
  68   70          z = scalbnl(z, -e0);
       71 +
  69   72          for (i = 0; i < 5; i++) {
  70   73                  t[i] = (double)((int)(z));
  71   74                  z = (z - (long double)t[i]) * two24l;
  72   75          }
       76 +
  73   77          nx = 5;
       78 +
  74   79          while (t[nx - 1] == 0.0)
  75      -                nx--;           /* skip zero term */
       80 +                nx--;                   /* skip zero term */
       81 +
  76   82          ipio2 = _TBL_ipio2l_inf;
  77   83          n = __rem_pio2m(t, v, e0, nx, 3, (const int *)ipio2);
  78   84          z = (long double)v[2] + (long double)v[1];
  79   85          w = (long double)v[0];
  80   86          y[0] = z + w;
  81   87          y[1] = z - (y[0] - w);
       88 +
  82   89          if (sign != 0) {
  83   90                  y[0] = -y[0];
  84   91                  y[1] = -y[1];
  85   92                  return (-n);
  86   93          }
       94 +
  87   95          return (n);
  88   96  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX