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

@@ -20,16 +20,17 @@
  */
 
 /*
  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  */
+
 /*
  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-/* INDENT OFF */
+
 /*
  * long double __k_cexpl(long double x, int *n);
  * Returns the exponential of x in the form of 2**n * y, y=__k_cexpl(x,&n).
  *
  *      1. Argument Reduction: given the input x, find r and integer k

@@ -64,95 +65,65 @@
  * Constants:
  * Only decimal values are given. We assume that the compiler will convert
  * from decimal to binary accurately enough to produce the correct
  * hexadecimal values.
  */
-/* INDENT ON */
 
 #include "libm.h"               /* __k_cexpl */
 #include "complex_wrapper.h"    /* HI_XWORD */
 
-/* INDENT OFF */
-/* ln2/32 = 0.0216608493924982909192885037955680177523593791987579766912713 */
+/*
+ * ln2/32 = 0.0216608493924982909192885037955680177523593791987579766912713
+ */
 #if defined(__x86)
 static const long double
                         /* 43 significant bits, 21 trailing zeros */
-ln2_32hi = 2.166084939249657281834515742957592010498046875e-2L,
-ln2_32lo = 1.7181009433463659920976473789104487579766912713e-15L;
+        ln2_32hi = 2.166084939249657281834515742957592010498046875e-2L,
+        ln2_32lo = 1.7181009433463659920976473789104487579766912713e-15L;
+
 static const long double exp2_32_hi[] = {       /* exp2_32[j] = 2^(j/32) */
-        1.0000000000000000000000000e+00L,
-        1.0218971486541166782081522e+00L,
-        1.0442737824274138402382006e+00L,
-        1.0671404006768236181297224e+00L,
-        1.0905077326652576591003302e+00L,
-        1.1143867425958925362894369e+00L,
-        1.1387886347566916536971221e+00L,
-        1.1637248587775775137938619e+00L,
-        1.1892071150027210666875674e+00L,
-        1.2152473599804688780476325e+00L,
-        1.2418578120734840485256747e+00L,
-        1.2690509571917332224885722e+00L,
-        1.2968395546510096659215822e+00L,
-        1.3252366431597412945939118e+00L,
-        1.3542555469368927282668852e+00L,
-        1.3839098819638319548151403e+00L,
-        1.4142135623730950487637881e+00L,
-        1.4451808069770466200253470e+00L,
-        1.4768261459394993113155431e+00L,
-        1.5091644275934227397133885e+00L,
-        1.5422108254079408235859630e+00L,
-        1.5759808451078864864006862e+00L,
-        1.6104903319492543080837174e+00L,
-        1.6457554781539648445110730e+00L,
-        1.6817928305074290860378350e+00L,
-        1.7186192981224779156032914e+00L,
-        1.7562521603732994831094730e+00L,
-        1.7947090750031071864148413e+00L,
-        1.8340080864093424633989166e+00L,
-        1.8741676341102999013002103e+00L,
-        1.9152065613971472938202589e+00L,
-        1.9571441241754002689657438e+00L,
+        1.0000000000000000000000000e+00L, 1.0218971486541166782081522e+00L,
+        1.0442737824274138402382006e+00L, 1.0671404006768236181297224e+00L,
+        1.0905077326652576591003302e+00L, 1.1143867425958925362894369e+00L,
+        1.1387886347566916536971221e+00L, 1.1637248587775775137938619e+00L,
+        1.1892071150027210666875674e+00L, 1.2152473599804688780476325e+00L,
+        1.2418578120734840485256747e+00L, 1.2690509571917332224885722e+00L,
+        1.2968395546510096659215822e+00L, 1.3252366431597412945939118e+00L,
+        1.3542555469368927282668852e+00L, 1.3839098819638319548151403e+00L,
+        1.4142135623730950487637881e+00L, 1.4451808069770466200253470e+00L,
+        1.4768261459394993113155431e+00L, 1.5091644275934227397133885e+00L,
+        1.5422108254079408235859630e+00L, 1.5759808451078864864006862e+00L,
+        1.6104903319492543080837174e+00L, 1.6457554781539648445110730e+00L,
+        1.6817928305074290860378350e+00L, 1.7186192981224779156032914e+00L,
+        1.7562521603732994831094730e+00L, 1.7947090750031071864148413e+00L,
+        1.8340080864093424633989166e+00L, 1.8741676341102999013002103e+00L,
+        1.9152065613971472938202589e+00L, 1.9571441241754002689657438e+00L,
 };
+
 static const long double exp2_32_lo[] = {
-        0.0000000000000000000000000e+00L,
-        2.6327965667180882569382524e-20L,
-        8.3765863521895191129661899e-20L,
-        3.9798705777454504249209575e-20L,
-        1.0668046596651558640993042e-19L,
-        1.9376009847285360448117114e-20L,
-        6.7081819456112953751277576e-21L,
-        1.9711680502629186462729727e-20L,
-        2.9932584438449523689104569e-20L,
-        6.8887754153039109411061914e-20L,
-        6.8002718741225378942847820e-20L,
-        6.5846917376975403439742349e-20L,
-        1.2171958727511372194876001e-20L,
-        3.5625253228704087115438260e-20L,
-        3.1129551559077560956309179e-20L,
-        5.7519192396164779846216492e-20L,
-        3.7900651177865141593101239e-20L,
-        1.1659262405698741798080115e-20L,
-        7.1364385105284695967172478e-20L,
-        5.2631003710812203588788949e-20L,
-        2.6328853788732632868460580e-20L,
-        5.4583950085438242788190141e-20L,
-        9.5803254376938269960718656e-20L,
-        7.6837733983874245823512279e-21L,
-        2.4415965910835093824202087e-20L,
-        2.6052966871016580981769728e-20L,
-        2.6876456344632553875309579e-21L,
-        1.2861930155613700201703279e-20L,
-        8.8166633394037485606572294e-20L,
-        2.9788615389580190940837037e-20L,
-        5.2352341619805098677422139e-20L,
-        5.2578463064010463732242363e-20L,
+        0.0000000000000000000000000e+00L, 2.6327965667180882569382524e-20L,
+        8.3765863521895191129661899e-20L, 3.9798705777454504249209575e-20L,
+        1.0668046596651558640993042e-19L, 1.9376009847285360448117114e-20L,
+        6.7081819456112953751277576e-21L, 1.9711680502629186462729727e-20L,
+        2.9932584438449523689104569e-20L, 6.8887754153039109411061914e-20L,
+        6.8002718741225378942847820e-20L, 6.5846917376975403439742349e-20L,
+        1.2171958727511372194876001e-20L, 3.5625253228704087115438260e-20L,
+        3.1129551559077560956309179e-20L, 5.7519192396164779846216492e-20L,
+        3.7900651177865141593101239e-20L, 1.1659262405698741798080115e-20L,
+        7.1364385105284695967172478e-20L, 5.2631003710812203588788949e-20L,
+        2.6328853788732632868460580e-20L, 5.4583950085438242788190141e-20L,
+        9.5803254376938269960718656e-20L, 7.6837733983874245823512279e-21L,
+        2.4415965910835093824202087e-20L, 2.6052966871016580981769728e-20L,
+        2.6876456344632553875309579e-21L, 1.2861930155613700201703279e-20L,
+        8.8166633394037485606572294e-20L, 2.9788615389580190940837037e-20L,
+        5.2352341619805098677422139e-20L, 5.2578463064010463732242363e-20L,
 };
 #else   /* sparc */
 static const long double
                         /* 0x3FF962E4 2FEFA39E F35793C7 00000000 */
-ln2_32hi = 2.166084939249829091928849858592451515688e-2L,
-ln2_32lo = 5.209643502595475652782654157501186731779e-27L;
+        ln2_32hi = 2.166084939249829091928849858592451515688e-2L,
+        ln2_32lo = 5.209643502595475652782654157501186731779e-27L;
 static const long double exp2_32_hi[] = {       /* exp2_32[j] = 2^(j/32) */
         1.000000000000000000000000000000000000000e+0000L,
         1.021897148654116678234480134783299439782e+0000L,
         1.044273782427413840321966478739929008785e+0000L,
         1.067140400676823618169521120992809162607e+0000L,

@@ -220,64 +191,71 @@
         +2.371815422825174835691651228302690977951e-0035L,
         -3.026891682096118773004597373421900314256e-0037L,
 };
 #endif
 
-static const long double
-        one = 1.0L,
+static const long double one = 1.0L,
         two = 2.0L,
         ln2_64 = 1.083042469624914545964425189778400898568e-2L,
         invln2_32 = 4.616624130844682903551758979206054839765e+1L;
 
 /* rational approximation coeffs for [-(ln2)/64,(ln2)/64] */
-static const long double
-        t1 =  1.666666666666666666666666666660876387437e-1L,
+static const long double t1 = 1.666666666666666666666666666660876387437e-1L,
         t2 = -2.777777777777777777777707812093173478756e-3L,
         t3 =  6.613756613756613482074280932874221202424e-5L,
         t4 = -1.653439153392139954169609822742235851120e-6L,
         t5 =  4.175314851769539751387852116610973796053e-8L;
-/* INDENT ON */
 
 long double
-__k_cexpl(long double x, int *n) {
+__k_cexpl(long double x, int *n)
+{
         int hx, ix, j, k;
         long double t, r;
 
         *n = 0;
         hx = HI_XWORD(x);
         ix = hx & 0x7fffffff;
+
         if (hx >= 0x7fff0000)
                 return (x + x); /* NaN of +inf */
-        if (((unsigned) hx) >= 0xffff0000)
+
+        if (((unsigned)hx) >= 0xffff0000)
                 return (-one / x);      /* NaN or -inf */
+
         if (ix < 0x3fc30000)
                 return (one + x);       /* |x|<2^-60 */
+
         if (hx > 0) {
                 if (hx > 0x401086a0) {  /* x > 200000 */
                         *n = 200000;
                         return (one);
                 }
-                k = (int) (invln2_32 * (x + ln2_64));
+
+                k = (int)(invln2_32 * (x + ln2_64));
         } else {
                 if (ix > 0x401086a0) {  /* x < -200000 */
                         *n = -200000;
                         return (one);
                 }
-                k = (int) (invln2_32 * (x - ln2_64));
+
+                k = (int)(invln2_32 * (x - ln2_64));
         }
+
         j = k & 0x1f;
         *n = k >> 5;
-        t = (long double) k;
+        t = (long double)k;
         x = (x - t * ln2_32hi) - t * ln2_32lo;
         t = x * x;
         r = (x - t * (t1 + t * (t2 + t * (t3 + t * (t4 + t * t5))))) - two;
         x = exp2_32_hi[j] - ((exp2_32_hi[j] * (x + x)) / r - exp2_32_lo[j]);
         k >>= 5;
+
         if (k > 240) {
                 XFSCALE(x, 240);
                 *n -= 240;
         } else if (k > 0) {
                 XFSCALE(x, k);
                 *n = 0;
         }
+
         return (x);
 }