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

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libm/common/complex/cexpf.c
          +++ new/usr/src/lib/libm/common/complex/cexpf.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 __cexpf = cexpf
  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  static const float zero = 0.0F;
  39   41  
  40   42  fcomplex
  41      -cexpf(fcomplex z) {
  42      -        fcomplex        ans;
  43      -        float           x, y, c, s;
  44      -        double          t;
  45      -        int             n, ix, iy, hx, hy;
       43 +cexpf(fcomplex z)
       44 +{
       45 +        fcomplex ans;
       46 +        float x, y, c, s;
       47 +        double t;
       48 +        int n, ix, iy, hx, hy;
  46   49  
  47   50          x = F_RE(z);
  48   51          y = F_IM(z);
  49   52          hx = THE_WORD(x);
  50   53          hy = THE_WORD(y);
  51   54          ix = hx & 0x7fffffff;
  52   55          iy = hy & 0x7fffffff;
  53      -        if (iy == 0) {          /* y = 0 */
       56 +
       57 +        if (iy == 0) {                  /* y = 0 */
  54   58                  F_RE(ans) = expf(x);
  55   59                  F_IM(ans) = y;
  56   60          } else if (ix == 0x7f800000) {  /* x is +-inf */
  57   61                  if (hx < 0) {
  58   62                          if (iy >= 0x7f800000) {
  59   63                                  F_RE(ans) = zero;
  60   64                                  F_IM(ans) = zero;
  61   65                          } else {
  62   66                                  sincosf(y, &s, &c);
  63   67                                  F_RE(ans) = zero * c;
↓ open down ↓ 4 lines elided ↑ open up ↑
  68   72                                  F_RE(ans) = x;
  69   73                                  F_IM(ans) = y - y;
  70   74                          } else {
  71   75                                  sincosf(y, &s, &c);
  72   76                                  F_RE(ans) = x * c;
  73   77                                  F_IM(ans) = x * s;
  74   78                          }
  75   79                  }
  76   80          } else {
  77   81                  sincosf(y, &s, &c);
       82 +
  78   83                  if (ix >= 0x42B171AA) { /* |x| > 88.722... ~ log(2**128) */
  79   84  #if defined(__i386) && !defined(__amd64)
  80      -                        int     rp = __swapRP(fp_extended);
       85 +                        int rp = __swapRP(fp_extended);
  81   86  #endif
  82   87                          t = __k_cexp(x, &n);
  83   88                          F_RE(ans) = (float)scalbn(t * (double)c, n);
  84   89                          F_IM(ans) = (float)scalbn(t * (double)s, n);
  85   90  #if defined(__i386) && !defined(__amd64)
  86   91                          if (rp != fp_extended)
  87   92                                  (void) __swapRP(rp);
  88   93  #endif
  89   94                  } else {
  90   95                          t = expf(x);
  91   96                          F_RE(ans) = t * c;
  92   97                          F_IM(ans) = t * s;
  93   98                  }
  94   99          }
      100 +
  95  101          return (ans);
  96  102  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX