From 7ce331c01ce6eb7b3f5c715a38a24359da9c6ee2 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 22 Nov 2001 14:04:29 +0000 Subject: Totally rework the math library, this time based on the MacOs X math library (which is itself based on the math lib from FreeBSD). -Erik --- libm/float/tanhf.c | 88 ------------------------------------------------------ 1 file changed, 88 deletions(-) delete mode 100644 libm/float/tanhf.c (limited to 'libm/float/tanhf.c') diff --git a/libm/float/tanhf.c b/libm/float/tanhf.c deleted file mode 100644 index 4636192c2..000000000 --- a/libm/float/tanhf.c +++ /dev/null @@ -1,88 +0,0 @@ -/* tanhf.c - * - * Hyperbolic tangent - * - * - * - * SYNOPSIS: - * - * float x, y, tanhf(); - * - * y = tanhf( x ); - * - * - * - * DESCRIPTION: - * - * Returns hyperbolic tangent of argument in the range MINLOG to - * MAXLOG. - * - * A polynomial approximation is used for |x| < 0.625. - * Otherwise, - * - * tanh(x) = sinh(x)/cosh(x) = 1 - 2/(exp(2x) + 1). - * - * - * - * ACCURACY: - * - * Relative error: - * arithmetic domain # trials peak rms - * IEEE -2,2 100000 1.3e-7 2.6e-8 - * - */ - -/* -Cephes Math Library Release 2.2: June, 1992 -Copyright 1984, 1987, 1989, 1992 by Stephen L. Moshier -Direct inquiries to 30 Frost Street, Cambridge, MA 02140 -*/ - -/* Single precision hyperbolic tangent - * test interval: [-0.625, +0.625] - * trials: 10000 - * peak relative error: 7.2e-8 - * rms relative error: 2.6e-8 - */ -#include - -extern float MAXLOGF; - -float expf( float ); - -float tanhf( float xx ) -{ -float x, z; - -if( xx < 0 ) - x = -xx; -else - x = xx; - -if( x > 0.5 * MAXLOGF ) - { - if( xx > 0 ) - return( 1.0 ); - else - return( -1.0 ); - } -if( x >= 0.625 ) - { - x = expf(x+x); - z = 1.0 - 2.0/(x + 1.0); - if( xx < 0 ) - z = -z; - } -else - { - z = x * x; - z = - (((( -5.70498872745E-3 * z - + 2.06390887954E-2) * z - - 5.37397155531E-2) * z - + 1.33314422036E-1) * z - - 3.33332819422E-1) * z * xx - + xx; - } -return( z ); -} -- cgit v1.2.3