xref: /aosp_15_r20/external/fdlibm/w_cosh.c (revision 1e651e1ef2b613db2c4b29ae59c1de74cf0222ae)
1*1e651e1eSRoland Levillain 
2*1e651e1eSRoland Levillain /* @(#)w_cosh.c 1.3 95/01/18 */
3*1e651e1eSRoland Levillain /*
4*1e651e1eSRoland Levillain  * ====================================================
5*1e651e1eSRoland Levillain  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6*1e651e1eSRoland Levillain  *
7*1e651e1eSRoland Levillain  * Developed at SunSoft, a Sun Microsystems, Inc. business.
8*1e651e1eSRoland Levillain  * Permission to use, copy, modify, and distribute this
9*1e651e1eSRoland Levillain  * software is freely granted, provided that this notice
10*1e651e1eSRoland Levillain  * is preserved.
11*1e651e1eSRoland Levillain  * ====================================================
12*1e651e1eSRoland Levillain  */
13*1e651e1eSRoland Levillain 
14*1e651e1eSRoland Levillain /*
15*1e651e1eSRoland Levillain  * wrapper ieee_cosh(x)
16*1e651e1eSRoland Levillain  */
17*1e651e1eSRoland Levillain 
18*1e651e1eSRoland Levillain #include "fdlibm.h"
19*1e651e1eSRoland Levillain 
20*1e651e1eSRoland Levillain #ifdef __STDC__
ieee_cosh(double x)21*1e651e1eSRoland Levillain 	double ieee_cosh(double x)		/* wrapper cosh */
22*1e651e1eSRoland Levillain #else
23*1e651e1eSRoland Levillain 	double ieee_cosh(x)			/* wrapper cosh */
24*1e651e1eSRoland Levillain 	double x;
25*1e651e1eSRoland Levillain #endif
26*1e651e1eSRoland Levillain {
27*1e651e1eSRoland Levillain #ifdef _IEEE_LIBM
28*1e651e1eSRoland Levillain 	return __ieee754_cosh(x);
29*1e651e1eSRoland Levillain #else
30*1e651e1eSRoland Levillain 	double z;
31*1e651e1eSRoland Levillain 	z = __ieee754_cosh(x);
32*1e651e1eSRoland Levillain 	if(_LIB_VERSION == _IEEE_ || ieee_isnan(x)) return z;
33*1e651e1eSRoland Levillain 	if(ieee_fabs(x)>7.10475860073943863426e+02) {
34*1e651e1eSRoland Levillain 	        return __kernel_standard(x,x,5); /* cosh overflow */
35*1e651e1eSRoland Levillain 	} else
36*1e651e1eSRoland Levillain 	    return z;
37*1e651e1eSRoland Levillain #endif
38*1e651e1eSRoland Levillain }
39