Print this page
11210 libm should be cstyle(1ONBLD) clean
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libm/common/complex/cexpl.c
+++ new/usr/src/lib/libm/common/complex/cexpl.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 __cexpl = cexpl
31 32
32 -#include "libm.h" /* expl/isinfl/iszerol/scalbnl/sincosl */
33 +#include "libm.h" /* expl/isinfl/iszerol/scalbnl/sincosl */
33 34 #include "complex_wrapper.h"
34 35
35 36 extern int isinfl(long double);
36 37 extern int iszerol(long double);
37 38
38 -/* INDENT OFF */
39 39 static const long double zero = 0.0L;
40 -/* INDENT ON */
40 +
41 41
42 42 ldcomplex
43 -cexpl(ldcomplex z) {
43 +cexpl(ldcomplex z)
44 +{
44 45 ldcomplex ans;
45 46 long double x, y, t, c, s;
46 47 int n, ix, iy, hx, hy;
47 48
48 49 x = LD_RE(z);
49 50 y = LD_IM(z);
50 51 hx = HI_XWORD(x);
51 52 hy = HI_XWORD(y);
52 53 ix = hx & 0x7fffffff;
53 54 iy = hy & 0x7fffffff;
54 - if (iszerol(y)) { /* y = 0 */
55 +
56 + if (iszerol(y)) { /* y = 0 */
55 57 LD_RE(ans) = expl(x);
56 58 LD_IM(ans) = y;
57 - } else if (isinfl(x)) { /* x is +-inf */
59 + } else if (isinfl(x)) { /* x is +-inf */
58 60 if (hx < 0) {
59 61 if (iy >= 0x7fff0000) {
60 62 LD_RE(ans) = zero;
61 63 LD_IM(ans) = zero;
62 64 } else {
63 65 sincosl(y, &s, &c);
64 66 LD_RE(ans) = zero * c;
65 67 LD_IM(ans) = zero * s;
66 68 }
67 69 } else {
68 70 if (iy >= 0x7fff0000) {
↓ open down ↓ |
1 lines elided |
↑ open up ↑ |
69 71 LD_RE(ans) = x;
70 72 LD_IM(ans) = y - y;
71 73 } else {
72 74 (void) sincosl(y, &s, &c);
73 75 LD_RE(ans) = x * c;
74 76 LD_IM(ans) = x * s;
75 77 }
76 78 }
77 79 } else {
78 80 (void) sincosl(y, &s, &c);
81 +
79 82 if (ix >= 0x400C62E4) { /* |x| > 11356.52... ~ log(2**16384) */
80 83 t = __k_cexpl(x, &n);
81 84 LD_RE(ans) = scalbnl(t * c, n);
82 85 LD_IM(ans) = scalbnl(t * s, n);
83 86 } else {
84 87 t = expl(x);
85 88 LD_RE(ans) = t * c;
86 89 LD_IM(ans) = t * s;
87 90 }
88 91 }
92 +
89 93 return (ans);
90 94 }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX