10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
24 */
25 /*
26 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
28 */
29
30 #if defined(ELFOBJ)
31 #pragma weak tanhl = __tanhl
32 #endif
33
34 /*
35 * tanhl(x) returns the hyperbolic tangent of x
36 *
37 * Method :
38 * 1. reduce x to non-negative: tanhl(-x) = - tanhl(x).
39 * 2.
40 * 0 < x <= small : tanhl(x) := x
41 * -expm1l(-2x)
42 * small < x <= 1 : tanhl(x) := --------------
43 * expm1l(-2x) + 2
44 * 2
45 * 1 <= x <= threshold : tanhl(x) := 1 - ---------------
46 * expm1l(2x) + 2
47 * threshold < x <= INF : tanhl(x) := 1.
48 *
49 * where
50 * single : small = 1.e-5 threshold = 11.0
51 * double : small = 1.e-10 threshold = 22.0
52 * quad : small = 1.e-20 threshold = 45.0
|
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
24 */
25 /*
26 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
28 */
29
30 #pragma weak __tanhl = tanhl
31
32 /*
33 * tanhl(x) returns the hyperbolic tangent of x
34 *
35 * Method :
36 * 1. reduce x to non-negative: tanhl(-x) = - tanhl(x).
37 * 2.
38 * 0 < x <= small : tanhl(x) := x
39 * -expm1l(-2x)
40 * small < x <= 1 : tanhl(x) := --------------
41 * expm1l(-2x) + 2
42 * 2
43 * 1 <= x <= threshold : tanhl(x) := 1 - ---------------
44 * expm1l(2x) + 2
45 * threshold < x <= INF : tanhl(x) := 1.
46 *
47 * where
48 * single : small = 1.e-5 threshold = 11.0
49 * double : small = 1.e-10 threshold = 22.0
50 * quad : small = 1.e-20 threshold = 45.0
|