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

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libm/common/R/logf.c
          +++ new/usr/src/lib/libm/common/R/logf.c
↓ open down ↓ 10 lines elided ↑ open up ↑
  11   11   * and limitations under the License.
  12   12   *
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  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   * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  23   24   */
       25 +
  24   26  /*
  25   27   * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  26   28   * Use is subject to license terms.
  27   29   */
  28   30  
  29   31  #pragma weak __logf = logf
  30   32  
  31   33  /*
  32   34   * Algorithm:
  33   35   *
↓ open down ↓ 64 lines elided ↑ open up ↑
  98  100          0.000000000000000000e+00, 5.960464477539062500e-08,
  99  101  };
 100  102  
 101  103  static const double C[] = {
 102  104          6.931471805599452862e-01,
 103  105          -2.49887584306188944706e-01,
 104  106          3.33368809981254554946e-01,
 105  107          -5.00000008402474976565e-01
 106  108  };
 107  109  
 108      -#define ln2     C[0]
 109      -#define K3      C[1]
 110      -#define K2      C[2]
 111      -#define K1      C[3]
      110 +#define ln2             C[0]
      111 +#define K3              C[1]
      112 +#define K2              C[2]
      113 +#define K1              C[3]
 112  114  
 113  115  float
 114  116  logf(float x)
 115  117  {
 116      -        double  v, t;
 117      -        float   f;
 118      -        int     hx, ix, i, exp, iy;
      118 +        double v, t;
      119 +        float f;
      120 +        int hx, ix, i, exp, iy;
 119  121  
 120  122          hx = *(int *)&x;
 121  123          ix = hx & ~0x80000000;
 122  124  
 123      -        if (ix >= 0x7f800000)   /* nan or inf */
 124      -                return ((hx < 0)? x * 0.0f : x * x);
      125 +        if (ix >= 0x7f800000)           /* nan or inf */
      126 +                return ((hx < 0) ? x * 0.0f : x *x);
 125  127  
 126  128          exp = 0;
 127      -        if (hx < 0x00800000) { /* negative, zero, or subnormal */
      129 +
      130 +        if (hx < 0x00800000) {          /* negative, zero, or subnormal */
 128  131                  if (hx <= 0) {
 129  132                          f = 0.0f;
 130      -                        return ((ix == 0)? -1.0f / f : f / f);
      133 +                        return ((ix == 0) ? -1.0f / f : f / f);
 131  134                  }
 132  135  
 133  136                  /* subnormal; scale by 2^149 */
 134  137                  f = (float)ix;
 135  138                  ix = *(int *)&f;
 136  139                  exp = -149;
 137  140          }
 138  141  
 139  142          exp += (ix - 0x3f320000) >> 23;
 140  143          ix &= 0x007fffff;
 141  144          iy = (ix + 0x20000) & 0xfffc0000;
 142  145          i = iy >> 17;
 143  146          t = ln2 * (double)exp + TBL[i];
 144  147          v = (double)(ix - iy) * TBL[i + 1];
 145  148          v += (v * v) * (K1 + v * (K2 + v * K3));
 146  149          f = (float)(t + v);
 147  150          return (f);
 148  151  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX