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

@@ -16,21 +16,23 @@
  * fields enclosed by brackets "[]" replaced with your own identifying
  * information: Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
  */
+
 /*
  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  */
+
 /*
  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
 #pragma weak __log = log
 
-/* INDENT OFF */
+
 /*
  * log(x)
  * Table look-up algorithm with product polynomial approximation.
  * By K.C. Ng, Oct 23, 2004. Updated Oct 18, 2005.
  *

@@ -93,18 +95,18 @@
  * The hexadecimal values are the intended ones for the following constants.
  * The decimal values may be used, provided that the compiler will convert
  * from decimal to binary accurately enough to produce the hexadecimal values
  * shown.
  */
-/* INDENT ON */
 
 #include "libm.h"
 
 extern const double _TBL_log[];
 
 static const double P[] = {
-/* ONE   */  1.0,
+/* ONE   */
+        1.0,
 /* TWO52 */  4503599627370496.0,
 /* LN2HI */  6.93147180369123816490e-01,        /* 3fe62e42, fee00000 */
 /* LN2LO */  1.90821492927058770002e-10,        /* 3dea39ef, 35793c76 */
 /* A1    */ -6.88821452420390473170286327331268694251775741577e-0002,
 /* A2    */  1.97493380704769294631262255279580131173133850098e+0000,

@@ -152,11 +154,12 @@
 #define B6    P[21]
 #define B7    P[22]
 #define B8    P[23]
 
 double
-log(double x) {
+log(double x)
+{
         double  *tb, dn, dn1, s, z, r, w;
         int     i, hx, ix, n, lx;
 
         n = 0;
         hx = ((int *)&x)[HIWORD];

@@ -165,14 +168,17 @@
 
         /* subnormal,0,negative,inf,nan */
         if ((hx + 0x100000) < 0x200000) {
                 if (ix > 0x7ff00000 || (ix == 0x7ff00000 && lx != 0)) /* nan */
                         return (x * x);
+
                 if (((hx << 1) | lx) == 0)              /* zero */
                         return (_SVID_libm_err(x, x, 16));
+
                 if (hx < 0)                             /* negative */
                         return (_SVID_libm_err(x, x, 17));
+
                 if (((hx - 0x7ff00000) | lx) == 0)      /* +inf */
                         return (x);
 
                 /* x must be positive and subnormal */
                 x *= TWO52;

@@ -180,24 +186,26 @@
                 ix = ((int *)&x)[HIWORD];
                 lx = ((int *)&x)[LOWORD];
         }
 
         i = ix >> 19;
+
         if (i >= 0x7f7 && i <= 0x806) {
                 /* 0.09375 (0x3fb80000) <= x < 24 (0x40380000) */
                 if (ix >= 0x3fec0000 && ix < 0x3ff22000) {
                         /* 0.875 <= x < 1.125 */
                         s = x - ONE;
                         z = s * s;
+
                         if (((ix - 0x3ff00000) | lx) == 0) /* x = 1 */
                                 return (z);
+
                         r = (A10 * s) * (A11 + s);
                         w = z * s;
-                        return (s + ((A1 * z) *
-                                (A2 + ((A3 * s) * (A4 + s) + w * (A5 + s)))) *
-                                ((A6 + (s * (A7 + s) + w * (A8 + s))) *
-                                (A9 + (r + w * (A12 + s)))));
+                        return (s + ((A1 * z) * (A2 + ((A3 * s) * (A4 + s) + w *
+                            (A5 + s)))) * ((A6 + (s * (A7 + s) + w *
+                            (A8 + s))) * (A9 + (r + w * (A12 + s)))));
                 } else {
                         i = (ix - 0x3fb80000) >> 15;
                         tb = (double *)_TBL_log + (i + i + i);
                         s = (x - tb[0]) * tb[1];
                         return (tb[2] +  ((B1 * s) * (B2 + s * (B3 + s))) *