Print this page
11210 libm should be cstyle(1ONBLD) clean
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libm/common/complex/ccoshl.c
+++ new/usr/src/lib/libm/common/complex/ccoshl.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
↓ open down ↓ |
14 lines elided |
↑ open up ↑ |
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
24 24 */
25 +
25 26 /*
26 27 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
27 28 * Use is subject to license terms.
28 29 */
29 30
30 31 #pragma weak __ccoshl = ccoshl
31 32
32 33 #include "libm.h" /* coshl/expl/fabsl/scalbnl/sincosl/sinhl/__k_cexpl */
33 34 #include "complex_wrapper.h"
34 35
35 -/* INDENT OFF */
36 36 static const long double zero = 0.0L, half = 0.5L;
37 -/* INDENT ON */
37 +
38 38
39 39 ldcomplex
40 -ccoshl(ldcomplex z) {
40 +ccoshl(ldcomplex z)
41 +{
41 42 long double t, x, y, S, C;
42 43 int hx, ix, hy, iy, n;
43 44 ldcomplex ans;
44 45
45 46 x = LD_RE(z);
46 47 y = LD_IM(z);
47 48 hx = HI_XWORD(x);
48 49 ix = hx & 0x7fffffff;
49 50 hy = HI_XWORD(y);
50 51 iy = hy & 0x7fffffff;
51 52 x = fabsl(x);
52 53 y = fabsl(y);
53 54
54 55 (void) sincosl(y, &S, &C);
55 - if (ix >= 0x4004e000) { /* |x| > 60 = prec/2 (14,28,34,60) */
56 +
57 + if (ix >= 0x4004e000) { /* |x| > 60 = prec/2 (14,28,34,60) */
56 58 if (ix >= 0x400C62E4) { /* |x| > 11356.52... ~ log(2**16384) */
57 59 if (ix >= 0x7fff0000) { /* |x| is inf or NaN */
58 60 if (y == zero) {
59 61 LD_RE(ans) = x;
60 62 LD_IM(ans) = y;
61 63 } else if (iy >= 0x7fff0000) {
62 64 LD_RE(ans) = x;
63 65 LD_IM(ans) = x - y;
64 66 } else {
65 67 LD_RE(ans) = C * x;
66 68 LD_IM(ans) = S * x;
67 69 }
68 70 } else {
69 71 t = __k_cexpl(x, &n);
70 - /* return exp(x)=t*2**n */
72 + /* return exp(x)=t*2**n */
71 73 LD_RE(ans) = scalbnl(C * t, n - 1);
72 74 LD_IM(ans) = scalbnl(S * t, n - 1);
73 75 }
74 76 } else {
75 77 t = expl(x) * half;
76 78 LD_RE(ans) = C * t;
77 79 LD_IM(ans) = S * t;
78 80 }
79 81 } else {
80 82 if (x == zero) { /* x = 0, return (C,0) */
81 83 LD_RE(ans) = C;
82 84 LD_IM(ans) = zero;
83 85 } else {
84 86 LD_RE(ans) = C * coshl(x);
85 87 LD_IM(ans) = S * sinhl(x);
86 88 }
87 89 }
90 +
88 91 if ((hx ^ hy) < 0)
89 92 LD_IM(ans) = -LD_IM(ans);
93 +
90 94 return (ans);
91 95 }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX