blob: 9f88f438666077665e21abc844d9dae6b3af28fd [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001
2/*
Kelly O'Hairfe008ae2010-05-25 15:58:33 -07003 * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
J. Duke319a3b92007-12-01 00:00:00 +00004 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
Kelly O'Hairfe008ae2010-05-25 15:58:33 -07008 * published by the Free Software Foundation. Oracle designates this
J. Duke319a3b92007-12-01 00:00:00 +00009 * particular file as subject to the "Classpath" exception as provided
Kelly O'Hairfe008ae2010-05-25 15:58:33 -070010 * by Oracle in the LICENSE file that accompanied this code.
J. Duke319a3b92007-12-01 00:00:00 +000011 *
12 * This code is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * version 2 for more details (a copy is included in the LICENSE file that
16 * accompanied this code).
17 *
18 * You should have received a copy of the GNU General Public License version
19 * 2 along with this work; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
Kelly O'Hairfe008ae2010-05-25 15:58:33 -070022 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
23 * or visit www.oracle.com if you need additional information or have any
24 * questions.
J. Duke319a3b92007-12-01 00:00:00 +000025 */
26
27/*
28 * wrapper cosh(x)
29 */
30
31#include "fdlibm.h"
32
33#ifdef __STDC__
34 double cosh(double x) /* wrapper cosh */
35#else
36 double cosh(x) /* wrapper cosh */
37 double x;
38#endif
39{
40#ifdef _IEEE_LIBM
41 return __ieee754_cosh(x);
42#else
43 double z;
44 z = __ieee754_cosh(x);
45 if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
46 if(fabs(x)>7.10475860073943863426e+02) {
47 return __kernel_standard(x,x,5); /* cosh overflow */
48 } else
49 return z;
50#endif
51}