Print this page
5261 libm should stop using synonyms.h
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.
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
↓ open down ↓ |
19 lines elided |
↑ open up ↑ |
20 20 */
21 21
22 22 /*
23 23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
24 24 */
25 25 /*
26 26 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
27 27 * Use is subject to license terms.
28 28 */
29 29
30 -#pragma weak cexpl = __cexpl
30 +#pragma weak __cexpl = cexpl
31 31
32 32 #include "libm.h" /* expl/isinfl/iszerol/scalbnl/sincosl */
33 33 #include "complex_wrapper.h"
34 34
35 35 extern int isinfl(long double);
36 36 extern int iszerol(long double);
37 37
38 38 /* INDENT OFF */
39 39 static const long double zero = 0.0L;
40 40 /* INDENT ON */
41 41
42 42 ldcomplex
43 43 cexpl(ldcomplex z) {
44 44 ldcomplex ans;
45 45 long double x, y, t, c, s;
46 46 int n, ix, iy, hx, hy;
47 47
48 48 x = LD_RE(z);
49 49 y = LD_IM(z);
50 50 hx = HI_XWORD(x);
51 51 hy = HI_XWORD(y);
52 52 ix = hx & 0x7fffffff;
53 53 iy = hy & 0x7fffffff;
54 54 if (iszerol(y)) { /* y = 0 */
55 55 LD_RE(ans) = expl(x);
56 56 LD_IM(ans) = y;
57 57 } else if (isinfl(x)) { /* x is +-inf */
58 58 if (hx < 0) {
59 59 if (iy >= 0x7fff0000) {
60 60 LD_RE(ans) = zero;
61 61 LD_IM(ans) = zero;
62 62 } else {
63 63 sincosl(y, &s, &c);
64 64 LD_RE(ans) = zero * c;
65 65 LD_IM(ans) = zero * s;
66 66 }
67 67 } else {
68 68 if (iy >= 0x7fff0000) {
69 69 LD_RE(ans) = x;
70 70 LD_IM(ans) = y - y;
71 71 } else {
72 72 (void) sincosl(y, &s, &c);
73 73 LD_RE(ans) = x * c;
74 74 LD_IM(ans) = x * s;
75 75 }
76 76 }
77 77 } else {
78 78 (void) sincosl(y, &s, &c);
79 79 if (ix >= 0x400C62E4) { /* |x| > 11356.52... ~ log(2**16384) */
80 80 t = __k_cexpl(x, &n);
81 81 LD_RE(ans) = scalbnl(t * c, n);
82 82 LD_IM(ans) = scalbnl(t * s, n);
83 83 } else {
84 84 t = expl(x);
85 85 LD_RE(ans) = t * c;
86 86 LD_IM(ans) = t * s;
87 87 }
88 88 }
89 89 return (ans);
90 90 }
↓ open down ↓ |
50 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX