cvs commit: src/lib/msun/src s_cbrt.c

Bruce Evans bde at
Thu Dec 15 08:23:23 PST 2005

bde         2005-12-15 16:23:22 UTC

  FreeBSD src repository

  Modified files:
    lib/msun/src         s_cbrt.c 
  Added comments about the apparently-magic rational function used in
  the second step of approximating cbrt(x).  It turns out to be neither
  very magic not nor very good.  It is just the (2,2) Pade approximation
  to 1/cbrt(r) at r = 1, arranged in a strange way to use fewer operations
  at a cost of replacing 4 multiplications by 1 division, which is an
  especially bad tradeoff on machines where some of the multiplications
  can be done in parallel.  A Remez rational approximation would give
  at least 2 more bits of accuracy, but the (2,2) Pade approximation
  already gives 6 more bits than needed.  (Changed the comment which
  essentially says that it gives 3 more bits.)
  Lower order Pade approximations are not quite accurate enough for
  double precision but are plenty for float precision.  A lower order
  Remez rational approximation might be enough for double precision too.
  However, rational approximations inherently require an extra division,
  and polynomial approximations work well for 1/cbrt(r) at r = 1, so I
  plan to switch to using the latter.  There are some technical
  complications that tend to cost a division in another way.
  Revision  Changes    Path
  1.11      +15 -1     src/lib/msun/src/s_cbrt.c

More information about the cvs-src mailing list