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

Bruce Evans bde at FreeBSD.org
Wed Jul 5 22:59:33 UTC 2006


bde         2006-07-05 22:59:33 UTC

  FreeBSD src repository

  Modified files:
    lib/msun/src         s_tanh.c 
  Log:
  Fixed tanh(-0.0) on ia64 and optimizeed tanh(x) for 2**-55 <= |x| <
  2**-28 as a side effect, by merging with the float precision version
  of tanh() and the double precision version of sinh().
  
  For tiny x, tanh(x) ~= x, and we used the expression x*(one+x) to
  return this value (x) and set the inexact flag iff x != 0.  This
  doesn't work on ia64 since gcc -O does the dubious optimization
  x*(one+x) = x+x*x so as to use fma, so the sign of -0.0 was lost.
  
  Instead, handle tiny x in the same as sinh(), although this is imperfect:
  - return x directly and set the inexact flag in a less efficient way.
  - increased the threshold for non-tinyness from 2**-55 to 2**-28 so that
    many more cases are optimized than are pessimized.
  
  Updated some comments and fixed bugs in others (ranges for half-open
  intervals mostly had the open end backwards, and there were nearby style
  bugs).
  
  Revision  Changes    Path
  1.8       +10 -10    src/lib/msun/src/s_tanh.c


More information about the cvs-all mailing list