Print this page
11210 libm should be cstyle(1ONBLD) clean
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libm/common/LD/__rem_pio2l.c
+++ new/usr/src/lib/libm/common/LD/__rem_pio2l.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 /*
31 32 * __rem_pio2l(x,y)
32 33 *
33 34 * return the remainder of x rem pi/2 in y[0]+y[1]
34 35 * by calling __rem_pio2m
35 36 */
36 37
37 38 #include "libm.h"
38 39 #include "longdouble.h"
39 40
40 41 extern const int _TBL_ipio2l_inf[];
41 -
42 -static const long double
43 - two24l = 16777216.0L,
44 - pio4 = 0.7853981633974483096156608458198757210495L;
42 +static const long double two24l = 16777216.0L,
43 + pio4 = 0.7853981633974483096156608458198757210495L;
45 44
46 45 int
47 46 __rem_pio2l(long double x, long double *y)
48 47 {
49 - long double z, w;
50 - double t[3], v[5];
51 - int e0, i, nx, n, sign;
48 + long double z, w;
49 + double t[3], v[5];
50 + int e0, i, nx, n, sign;
52 51
53 52 sign = signbitl(x);
54 53 z = fabsl(x);
54 +
55 55 if (z <= pio4) {
56 56 y[0] = x;
57 57 y[1] = 0;
58 58 return (0);
59 59 }
60 +
60 61 e0 = ilogbl(z) - 23;
61 62 z = scalbnl(z, -e0);
63 +
62 64 for (i = 0; i < 3; i++) {
63 65 t[i] = (double)((int)(z));
64 66 z = (z - (long double)t[i]) * two24l;
65 67 }
68 +
66 69 nx = 3;
67 - while (t[nx-1] == 0.0)
68 - nx--; /* omit trailing zeros */
70 +
71 + while (t[nx - 1] == 0.0)
72 + nx--; /* omit trailing zeros */
73 +
69 74 n = __rem_pio2m(t, v, e0, nx, 2, _TBL_ipio2l_inf);
70 75 z = (long double)v[1];
71 76 w = (long double)v[0];
72 77 y[0] = z + w;
73 78 y[1] = z - (y[0] - w);
79 +
74 80 if (sign != 0) {
75 81 y[0] = -y[0];
76 82 y[1] = -y[1];
77 83 return (-n);
78 84 }
85 +
79 86 return (n);
80 87 }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX