4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
26 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
32 * return the remainder of x rem pi/2 in y[0]+y[1]
33 * by calling __rem_pio2m
37 #include "longdouble.h"
39 extern const int _TBL_ipio2l_inf
[];
41 static const long double
43 pio4
= 0.7853981633974483096156608458198757210495L;
46 __rem_pio2l(long double x
, long double *y
)
50 int e0
, i
, nx
, n
, sign
;
61 for (i
= 0; i
< 3; i
++) {
62 t
[i
] = (double)((int)(z
));
63 z
= (z
- (long double)t
[i
]) * two24l
;
66 while (t
[nx
-1] == 0.0)
67 nx
--; /* omit trailing zeros */
68 n
= __rem_pio2m(t
, v
, e0
, nx
, 2, _TBL_ipio2l_inf
);
69 z
= (long double)v
[1];
70 w
= (long double)v
[0];
72 y
[1] = z
- (y
[0] - w
);