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

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libm/common/complex/csinhf.c
          +++ new/usr/src/lib/libm/common/complex/csinhf.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 __csinhf = csinhf
  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, half = 0.5F;
  39   41  
  40   42  fcomplex
  41      -csinhf(fcomplex z) {
  42      -        float           x, y, S, C;
  43      -        double          t;
  44      -        int             hx, ix, hy, iy, n;
  45      -        fcomplex        ans;
       43 +csinhf(fcomplex z)
       44 +{
       45 +        float x, y, S, C;
       46 +        double t;
       47 +        int hx, ix, hy, iy, n;
       48 +        fcomplex ans;
  46   49  
  47   50          x = F_RE(z);
  48   51          y = F_IM(z);
  49   52          hx = THE_WORD(x);
  50   53          ix = hx & 0x7fffffff;
  51   54          hy = THE_WORD(y);
  52   55          iy = hy & 0x7fffffff;
  53   56          x = fabsf(x);
  54   57          y = fabsf(y);
  55   58  
  56   59          sincosf(y, &S, &C);
  57      -        if (ix >= 0x41600000) { /* |x| > 14 = prec/2 (14,28,34,60) */
       60 +
       61 +        if (ix >= 0x41600000) {         /* |x| > 14 = prec/2 (14,28,34,60) */
  58   62                  if (ix >= 0x42B171AA) { /* |x| > 88.722... ~ log(2**128) */
  59   63                          if (ix >= 0x7f800000) { /* |x| is inf or NaN */
  60   64                                  if (iy == 0) {
  61   65                                          F_RE(ans) = x;
  62   66                                          F_IM(ans) = y;
  63   67                                  } else if (iy >= 0x7f800000) {
  64   68                                          F_RE(ans) = x;
  65   69                                          F_IM(ans) = x - y;
  66   70                                  } else {
  67   71                                          F_RE(ans) = C * x;
  68   72                                          F_IM(ans) = S * x;
  69   73                                  }
  70   74                          } else {
  71   75  #if defined(__i386) && !defined(__amd64)
  72      -                                int     rp = __swapRP(fp_extended);
       76 +                                int rp = __swapRP(fp_extended);
  73   77  #endif
  74   78                                  /* return (C, S) * exp(x) / 2 */
  75   79                                  t = __k_cexp((double)x, &n);
  76   80                                  F_RE(ans) = (float)scalbn(C * t, n - 1);
  77   81                                  F_IM(ans) = (float)scalbn(S * t, n - 1);
  78   82  #if defined(__i386) && !defined(__amd64)
  79   83                                  if (rp != fp_extended)
  80   84                                          (void) __swapRP(rp);
  81   85  #endif
  82   86                          }
  83   87                  } else {
  84   88                          t = expf(x) * half;
  85   89                          F_RE(ans) = C * t;
  86   90                          F_IM(ans) = S * t;
  87   91                  }
  88   92          } else {
  89      -                if (ix == 0) {  /* x = 0, return (0,S) */
       93 +                if (ix == 0) {          /* x = 0, return (0,S) */
  90   94                          F_RE(ans) = zero;
  91   95                          F_IM(ans) = S;
  92   96                  } else {
  93   97                          F_RE(ans) = C * sinhf(x);
  94   98                          F_IM(ans) = S * coshf(x);
  95   99                  }
  96  100          }
      101 +
  97  102          if (hx < 0)
  98  103                  F_RE(ans) = -F_RE(ans);
      104 +
  99  105          if (hy < 0)
 100  106                  F_IM(ans) = -F_IM(ans);
      107 +
 101  108          return (ans);
 102  109  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX