Print this page
5261 libm should stop using synonyms.h
5298 fabs is 0-sized, confuses dis(1) and others
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Approved by: Gordon Ross <gwr@nexenta.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libmvec/common/__vrsqrtf.c
          +++ new/usr/src/lib/libmvec/common/__vrsqrtf.c
↓ open down ↓ 19 lines elided ↑ open up ↑
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  24   24   */
  25   25  /*
  26   26   * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  27   27   * Use is subject to license terms.
  28   28   */
  29   29  
  30      -#include "libm_synonyms.h"
  31   30  #include "libm_inlines.h"
  32   31  
  33   32  #ifdef __RESTRICT
  34   33  #define restrict _Restrict
  35   34  #else
  36   35  #define restrict
  37   36  #endif
  38   37  
  39   38  /* float rsqrtf(float x)
  40   39   *
↓ open down ↓ 23 lines elided ↑ open up ↑
  64   63   *                      1/sqrt(1 + z) = ((a3 * z + a2) * z + a1) * z + a0
  65   64   *                      where z = [-1/64, 1/64].
  66   65   *
  67   66   * Accuracy:
  68   67   *      The maximum relative error for the approximating
  69   68   *      polynomial is 2**(-27.87).
  70   69   *      Maximum error observed: less than 0.534 ulp for the
  71   70   *      whole float type range.
  72   71   */
  73   72  
  74      -#define sqrtf __sqrtf
  75      -
  76   73  extern float sqrtf(float);
  77   74  
  78   75  static const double __TBL_rsqrtf[] = {
  79   76  /*
  80   77  i = [0,63]
  81   78   TBL[2*i  ] = 1 / (*(double*)&(0x3fe0000000000000ULL + (i << 46))) * 2**-24;
  82   79   TBL[2*i+1] = 1 / sqrtl(*(double*)&(0x3fe0000000000000ULL + (i << 46)));
  83   80  i = [64,127]
  84   81   TBL[2*i  ] = 1 / (*(double*)&(0x3fe0000000000000ULL + (i << 46))) * 2**-23;
  85   82   TBL[2*i+1] = 1 / sqrtl(*(double*)&(0x3fe0000000000000ULL + (i << 46)));
↓ open down ↓ 410 lines elided ↑ open up ↑
 496  493                  iax0 = ax0 - iax0;
 497  494                  xx0 = iax0 * tbl_div0;
 498  495                  res0 = tbl_sqrt0 * (((A3 * xx0 + A2) * xx0 + A1) * xx0 + A0);
 499  496  
 500  497                  fres0 = res0;
 501  498                  iexp0 += *(int*)&fres0;
 502  499                  *(int*)py = iexp0;
 503  500                  py += stridey;
 504  501          }
 505  502  }
 506      -
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX