2 * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 * See the copyright notice in the ACK home directory, in the file "Copyright".
5 * Author: Ceriel J.H. Jacobs
7 /* $Id: sinh.c,v 1.4 1994/06/24 11:44:15 ceriel Exp $ */
12 #include "localmath.h"
15 sinh_cosh(double x, int cosh_flag)
17 /* Algorithm and coefficients from:
18 "Software manual for the elementary functions"
19 by W.J. Cody and W. Waite, Prentice-Hall, 1980
23 -0.35181283430177117881e+6,
24 -0.11563521196851768270e+5,
25 -0.16375798202630751372e+3,
26 -0.78966127417357099479e+0
29 -0.21108770058106271242e+7,
30 0.36162723109421836460e+5,
31 -0.27773523119650701167e+3,
35 double y = negative ? -x : x;
41 if (! cosh_flag && y <= 1.0) {
42 /* ??? check for underflow ??? */
44 return x + x * y * POLYNOM3(y, p)/POLYNOM3(y,q);
47 if (y >= M_LN_MAX_D) {
48 /* exp(y) would cause overflow */
49 #define LNV 0.69316101074218750000e+0
50 #define VD2M1 0.52820835025874852469e-4
53 if (w < M_LN_MAX_D+M_LN2-LNV) {
65 x = 0.5 * (z + (cosh_flag ? 1.0 : -1.0)/z);
67 return negative ? -x : x;
73 return sinh_cosh(x, 0);
80 return sinh_cosh(x, 1);