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

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libm/common/Q/log10l.c
          +++ new/usr/src/lib/libm/common/Q/log10l.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  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   23   * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  24   24   */
       25 +
  25   26  /*
  26   27   * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  27   28   * Use is subject to license terms.
  28   29   */
  29   30  
  30   31  #pragma weak __log10l = log10l
  31   32  
  32   33  /*
  33   34   * log10l(X)
  34   35   *
↓ open down ↓ 23 lines elided ↑ open up ↑
  58   59   * from decimal to binary accurately enough to produce the hexadecimal values
  59   60   * shown.
  60   61   */
  61   62  
  62   63  #include "libm.h"
  63   64  #include "longdouble.h"
  64   65  
  65   66  #if defined(__x86)
  66   67  #define __swapRD        __swap87RD
  67   68  #endif
  68      -extern enum fp_direction_type __swapRD(enum fp_direction_type);
  69   69  
  70      -static const long double
  71      -        zero      = 0.0L,
  72      -        ivln10    = 4.342944819032518276511289189166050822944e-0001L,
  73      -        one       = 1.0L,
       70 +extern enum fp_direction_type __swapRD(enum fp_direction_type);
       71 +static const long double zero = 0.0L,
       72 +        ivln10 = 4.342944819032518276511289189166050822944e-0001L,
       73 +        one = 1.0L,
  74   74  #if defined(__x86)
  75   75          log10_2hi = 3.010299956639803653501985536422580480576e-01L,
  76   76          log10_2lo = 8.298635403410822349787106337291183585413e-16L;
  77   77  #elif defined(__sparc)
  78   78          log10_2hi = 3.010299956639811952137388947242098603469e-01L,
  79   79          log10_2lo = 2.831664213089468167896664371953210945664e-31L;
  80   80  #else
  81   81  #error Unknown Architecture!
  82   82  #endif
  83   83  
  84   84  long double
  85      -log10l(long double x) {
       85 +log10l(long double x)
       86 +{
  86   87          long double y, z;
  87   88          enum fp_direction_type rd;
  88   89          int n;
  89   90  
  90      -        if (!finitel(x))
       91 +        if (!finitel(x)) {
  91   92                  return (x + fabsl(x));  /* x is +-INF or NaN */
  92      -        else if (x > zero) {
       93 +        } else if (x > zero) {
  93   94                  n = ilogbl(x);
       95 +
  94   96                  if (n < 0)
  95   97                          n += 1;
       98 +
  96   99                  rd = __swapRD(fp_nearest);
  97  100                  y = n;
  98  101                  x = scalbnl(x, -n);
  99  102                  z = y * log10_2lo + ivln10 * logl(x);
 100  103                  z += y * log10_2hi;
      104 +
 101  105                  if (rd != fp_nearest)
 102  106                          (void) __swapRD(rd);
      107 +
 103  108                  return (z);
 104      -        } else if (x == zero)   /* -INF */
      109 +        } else if (x == zero) {         /* -INF */
 105  110                  return (-one / zero);
 106      -        else                    /* x <0, return NaN */
      111 +        } else {                        /* x <0, return NaN */
 107  112                  return (zero / zero);
      113 +        }
 108  114  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX