Print this page
5261 libm should stop using synonyms.h
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libm/common/complex/clogl.c
+++ new/usr/src/lib/libm/common/complex/clogl.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 clogl = __clogl
30 +#pragma weak __clogl = clogl
31 31
32 32 #include "libm.h" /* atan2l/fabsl/isinfl/log1pl/logl/__k_clog_rl */
33 33 #include "complex_wrapper.h"
34 34 #include "longdouble.h"
35 35
36 36 #if defined(__sparc)
37 37 #define SIGP7 120
38 38 #define HSIGP7 60
39 39 #elif defined(__x86)
40 40 #define SIGP7 70
41 41 #define HSIGP7 35
42 42 #endif
43 43
44 44 /* INDENT OFF */
45 45 static const long double zero = 0.0L, half = 0.5L, one = 1.0L;
46 46 /* INDENT ON */
47 47
48 48 ldcomplex
49 49 clogl(ldcomplex z) {
50 50 ldcomplex ans;
51 51 long double x, y, t, ax, ay;
52 52 int n, ix, iy, hx, hy;
53 53
54 54 x = LD_RE(z);
55 55 y = LD_IM(z);
56 56 hx = HI_XWORD(x);
57 57 hy = HI_XWORD(y);
58 58 ix = hx & 0x7fffffff;
59 59 iy = hy & 0x7fffffff;
60 60 ay = fabsl(y);
61 61 ax = fabsl(x);
62 62 LD_IM(ans) = atan2l(y, x);
63 63 if (ix < iy || (ix == iy && ix < 0x7fff0000 && ax < ay)) {
64 64 /* swap x and y to force ax>=ay */
65 65 t = ax;
66 66 ax = ay;
67 67 ay = t;
68 68 n = ix, ix = iy;
69 69 iy = n;
70 70 }
71 71 n = (ix - iy) >> 16;
72 72 if (ix >= 0x7fff0000) { /* x or y is Inf or NaN */
73 73 if (isinfl(ax))
74 74 LD_RE(ans) = ax;
75 75 else if (isinfl(ay))
76 76 LD_RE(ans) = ay;
77 77 else
78 78 LD_RE(ans) = ax + ay;
79 79 } else if (ay == zero)
80 80 LD_RE(ans) = logl(ax);
81 81 else if (((0x3fffffff - ix) ^ (ix - 0x3ffe0000)) >= 0) {
82 82 /* 0.5 <= x < 2 */
83 83 if (ix >= 0x3fff0000) {
84 84 if (ax == one)
85 85 LD_RE(ans) = half * log1pl(ay * ay);
86 86 else if (n >= SIGP7)
87 87 LD_RE(ans) = logl(ax);
88 88 else
89 89 LD_RE(ans) = half * (log1pl(ay * ay + (ax -
90 90 one) * (ax + one)));
91 91 } else if (n >= SIGP7)
92 92 LD_RE(ans) = logl(ax);
93 93 else
94 94 LD_RE(ans) = __k_clog_rl(x, y, &t);
95 95 } else if (n >= HSIGP7)
96 96 LD_RE(ans) = logl(ax);
97 97 else if (ix < 0x5f3f0000 && iy >= 0x20bf0000)
98 98 /* 2**-8000 < y < x < 2**8000 */
99 99 LD_RE(ans) = half * logl(ax * ax + ay * ay);
100 100 else {
101 101 t = ay / ax;
102 102 LD_RE(ans) = logl(ax) + half * log1pl(t * t);
103 103 }
104 104 return (ans);
105 105 }
↓ open down ↓ |
65 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX