tanh is an odd function

Andreas Jaeger aj@suse.de
Mon May 14 01:14:00 GMT 2001


Stephen L Moshier <moshier@mediaone.net> writes:

> The following test case fails on i386 with libc-2.2.3.  Fix is below.
> 
> ----
> long double tanhl (long double);
> 
> int
> main()
> {
>   long double x, y, ny;
> 
>   x = -1.0;
>   ny = tanhl (x);
>   y = tanhl (-x);
>   if (y == ny)
>     abort ();
>   exit (0);
> }

And here's a patch for the testsuite that I've just committed,

Andreas

============================================================
Index: math/libm-test.inc
--- math/libm-test.inc	2001/05/07 21:29:11	1.32
+++ math/libm-test.inc	2001/05/14 08:13:39
@@ -3954,6 +3954,10 @@
   TEST_f_f (tanh, nan_value, nan_value);
 
   TEST_f_f (tanh, 0.7L, 0.60436777711716349631L);
+  TEST_f_f (tanh, -0.7L, -0.60436777711716349631L);
+
+  TEST_f_f (tanh, 1.0L, 0.7615941559557648881194582826047935904L);
+  TEST_f_f (tanh, -1.0L, -0.7615941559557648881194582826047935904L);
 
   END (tanh);
 }

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj



More information about the Libc-alpha mailing list