4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
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]
23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
26 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
30 #pragma weak __ccoshl = ccoshl
32 #include "libm.h" /* coshl/expl/fabsl/scalbnl/sincosl/sinhl/__k_cexpl */
33 #include "complex_wrapper.h"
36 static const long double zero
= 0.0L, half
= 0.5L;
41 long double t
, x
, y
, S
, C
;
42 int hx
, ix
, hy
, iy
, n
;
54 (void) sincosl(y
, &S
, &C
);
55 if (ix
>= 0x4004e000) { /* |x| > 60 = prec/2 (14,28,34,60) */
56 if (ix
>= 0x400C62E4) { /* |x| > 11356.52... ~ log(2**16384) */
57 if (ix
>= 0x7fff0000) { /* |x| is inf or NaN */
61 } else if (iy
>= 0x7fff0000) {
70 /* return exp(x)=t*2**n */
71 LD_RE(ans
) = scalbnl(C
* t
, n
- 1);
72 LD_IM(ans
) = scalbnl(S
* t
, n
- 1);
80 if (x
== zero
) { /* x = 0, return (C,0) */
84 LD_RE(ans
) = C
* coshl(x
);
85 LD_IM(ans
) = S
* sinhl(x
);
89 LD_IM(ans
) = -LD_IM(ans
);