cvs commit: src/lib/msun/src e_lgammaf_r.c k_cosf.c k_sinf.c math_private.h s_cosf.c s_sinf.c

Bruce Evans bde at FreeBSD.org
Mon Nov 28 04:58:58 GMT 2005


bde         2005-11-28 04:58:57 UTC

  FreeBSD src repository

  Modified files:
    lib/msun/src         e_lgammaf_r.c k_cosf.c k_sinf.c 
                         math_private.h s_cosf.c s_sinf.c 
  Log:
  Use only double precision for "kernel" cosf and sinf (except for
  returning float).  The functions are renamed from __kernel_{cos,sin}f()
  to __kernel_{cos,sin}df() so that misuses of them will cause link errors
  and not crashes.
  
  This version is an almost-routine translation with no special optimizations
  for accuracy or efficiency.  The not-quite-routine part is that in
  __kernel_cosf(), regenerating the minimax polynomial with double
  precision coefficients gives a coefficient for the x**2 term that is
  not quite -0.5, so the literal 0.5 in the code and the related `hz'
  variable need to be modified; also, the special code for reducing the
  error in 1.0-x**2*0.5 is no longer needed, so it is convenient to
  adjust all the logic for the x**2 term a little.  Note that without
  extra precision, it would be very bad to use a coefficient of other
  than -0.5 for the x**2 term -- the old version depends on multiplication
  by -0.5 being infinitely precise so as not to need even more special
  code for reducing the error in 1-x**2*0.5.
  
  This gives an unimportant increase in accuracy, from ~0.8 to ~0.501
  ulps.  Almost all of the error is from the final rounding step, since
  the choice of the minimax polynomials so that their contribution to the
  error is a bit less than 0.5 ulps just happens to give contributions that
  are significantly less (~.001 ulps).
  
  An Athlons, for uniformly distributed args in [-2pi, 2pi], this gives
  overall speed increases in the 10-20% range, despite giving a speed
  decrease of typically 19% (from 31 cycles up to 37) for sinf() on args
  in [-pi/4, pi/4].
  
  Revision  Changes    Path
  1.8       +6 -6      src/lib/msun/src/e_lgammaf_r.c
  1.14      +11 -12    src/lib/msun/src/k_cosf.c
  1.12      +11 -13    src/lib/msun/src/k_sinf.c
  1.20      +2 -2      src/lib/msun/src/math_private.h
  1.12      +7 -19     src/lib/msun/src/s_cosf.c
  1.12      +7 -19     src/lib/msun/src/s_sinf.c


More information about the cvs-src mailing list