]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fixed tanh(-0.0) on ia64 and optimizeed tanh(x) for 2**-55 <= |x| <
authorbde <bde@FreeBSD.org>
Wed, 5 Jul 2006 22:59:33 +0000 (22:59 +0000)
committerbde <bde@FreeBSD.org>
Wed, 5 Jul 2006 22:59:33 +0000 (22:59 +0000)
commitebfec8dd17bf246ce347fe94ba6c05bce1b02f5e
tree647731f60d6783f4360e86f8b034089a85b061fb
parenteeaf8558c3eca277c83abbbfef4341681a0d3af5
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).
lib/msun/src/s_tanh.c