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

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libm/common/complex/clogf.c
          +++ new/usr/src/lib/libm/common/complex/clogf.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 __clogf = clogf
  30   32  
  31   33  #include "libm.h"
  32   34  #include "complex_wrapper.h"
  33   35  
  34   36  #if defined(__i386) && !defined(__amd64)
  35   37  extern int __swapRP(int);
  36   38  #endif
  37   39  
  38   40  fcomplex
  39      -clogf(fcomplex z) {
  40      -        fcomplex        ans;
  41      -        float           x, y, ax, ay;
  42      -        double          dx, dy;
  43      -        int             ix, iy, hx, hy;
       41 +clogf(fcomplex z)
       42 +{
       43 +        fcomplex ans;
       44 +        float x, y, ax, ay;
       45 +        double dx, dy;
       46 +        int ix, iy, hx, hy;
  44   47  
  45   48          x = F_RE(z);
  46   49          y = F_IM(z);
  47   50          hx = THE_WORD(x);
  48   51          hy = THE_WORD(y);
  49   52          ix = hx & 0x7fffffff;
  50   53          iy = hy & 0x7fffffff;
  51   54          ay = fabsf(y);
  52   55          ax = fabsf(x);
  53   56          F_IM(ans) = atan2f(y, x);
       57 +
  54   58          if (ix >= 0x7f800000 || iy >= 0x7f800000) {
  55   59                  /* x or y is Inf or NaN */
  56   60                  if (iy == 0x7f800000)
  57   61                          F_RE(ans) = ay;
  58   62                  else if (ix == 0x7f800000)
  59   63                          F_RE(ans) = ax;
  60   64                  else
  61   65                          F_RE(ans) = ax + ay;
  62   66          } else {
  63   67  #if defined(__i386) && !defined(__amd64)
  64      -                int     rp = __swapRP(fp_extended);
       68 +                int rp = __swapRP(fp_extended);
  65   69  #endif
  66   70                  dx = (double)ax;
  67   71                  dy = (double)ay;
       72 +
  68   73                  if (ix == 0x3f800000)
  69   74                          F_RE(ans) = (float)(0.5 * log1p(dy * dy));
  70   75                  else if (iy == 0x3f800000)
  71   76                          F_RE(ans) = (float)(0.5 * log1p(dx * dx));
  72   77                  else if ((ix | iy) == 0)
  73   78                          F_RE(ans) = -1.0f / ax;
  74   79                  else
  75   80                          F_RE(ans) = (float)(0.5 * log(dx * dx + dy * dy));
       81 +
  76   82  #if defined(__i386) && !defined(__amd64)
  77   83                  if (rp != fp_extended)
  78   84                          (void) __swapRP(rp);
  79   85  #endif
  80   86          }
       87 +
  81   88          return (ans);
  82   89  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX