2001-06-19  Andreas Jaeger  <aj@suse.de>

	* sysdeps/ieee754/ldbl-128/s_tanhl.c: New file.

	* math/libm-test.inc (tanh_test): Test for 2^-56.

	* sysdeps/ieee754/ldbl-96/s_tanhl.c (__tanhl): Make sure result
	equals argument when x < 2^-55.
	Patches by Stephen L. Moshier <moshier@na-net.ornl.gov>.
This commit is contained in:
Andreas Jaeger 2001-06-19 12:41:02 +00:00
parent ba0fd1ba02
commit 20f421e1a1
4 changed files with 16 additions and 3 deletions

View File

@ -1,3 +1,13 @@
2001-06-19 Andreas Jaeger <aj@suse.de>
* sysdeps/ieee754/ldbl-128/s_tanhl.c: New file.
* math/libm-test.inc (tanh_test): Test for 2^-56.
* sysdeps/ieee754/ldbl-96/s_tanhl.c (__tanhl): Make sure result
equals argument when x < 2^-55.
Patches by Stephen L. Moshier <moshier@na-net.ornl.gov>.
2001-06-17 Alan Modra <amodra@bigpond.net.au> 2001-06-17 Alan Modra <amodra@bigpond.net.au>
* sysdeps/hppa/dl-machine.h (elf_machine_rela): handle relocs * sysdeps/hppa/dl-machine.h (elf_machine_rela): handle relocs

4
NEWS
View File

@ -8,8 +8,8 @@ Please send GNU C library bug reports using the `glibcbug' script to
Version 2.2.4 Version 2.2.4
* Stephen Moshier implemented cosh, expm1, log1p, acos, sinh for the * Stephen Moshier implemented cosh, expm1, log1p, acos, sinh, tanh for
128-bit long double format. the 128-bit long double format.
* Bruno Haible updated all the code handling Unicode in some form to * Bruno Haible updated all the code handling Unicode in some form to
support Unicode 3.1. support Unicode 3.1.

View File

@ -3975,6 +3975,9 @@ tanh_test (void)
TEST_f_f (tanh, 1.0L, 0.7615941559557648881194582826047935904L); TEST_f_f (tanh, 1.0L, 0.7615941559557648881194582826047935904L);
TEST_f_f (tanh, -1.0L, -0.7615941559557648881194582826047935904L); TEST_f_f (tanh, -1.0L, -0.7615941559557648881194582826047935904L);
/* 2^-56 */
TEST_f_f (tanh, 1.387778780781445675529539585113525390625e-17L, 1.387778780781445675529539585113525390625e-17L);
END (tanh); END (tanh);
} }

View File

@ -78,7 +78,7 @@ static long double one=1.0, two=2.0, tiny = 1.0e-4900L;
if ((ix|j0|j1) == 0) if ((ix|j0|j1) == 0)
return x; /* x == +- 0 */ return x; /* x == +- 0 */
if (ix<0x3fc8) /* |x|<2**-55 */ if (ix<0x3fc8) /* |x|<2**-55 */
return x*(one+x); /* tanh(small) = small */ return x*(one+tiny); /* tanh(small) = small */
if (ix>=0x3fff) { /* |x|>=1 */ if (ix>=0x3fff) { /* |x|>=1 */
t = __expm1l(two*fabsl(x)); t = __expm1l(two*fabsl(x));
z = one - two/(t+two); z = one - two/(t+two);