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.
30 #pragma weak __nextafterl = nextafterl
33 #include <float.h> /* LDBL_MAX, LDBL_MIN */
48 if (--px[n3] == 0xffffffff) \
49 if (--px[n2] == 0xffffffff) \
50 if (--px[n1] == 0xffffffff) \
59 * if pseudo-denormal, replace by the equivalent normal
61 #define X86PDNRM1(x) if (XBIASED_EXP(x) == 0 && (((int *) &x)[1] & \
66 if ((++px[n1] & ~0x80000000) == 0) \
67 px[n1] = 0x80000000, ++px[n0]; \
70 if (--px[n2] == 0xffffffff) \
71 if (--px[n1] == 0x7fffffff) \
72 if ((--px[n0] & 0x7fff) != 0) \
73 px[n1] |= 0x80000000; \
78 nextafterl(long double x
, long double y
) {
83 return (y
); /* C99 requirement */
87 if (ISZEROL(x
)) { /* x == 0.0 */
88 px
[n0
] = py
[n0
] & XSGNMSK
;
93 if ((px
[n0
] & XSGNMSK
) == 0) { /* x > 0.0 */
94 if (x
> y
) /* x > y */
99 if (x
< y
) /* x < y */
106 volatile long double dummy
;
107 int k
= XBIASED_EXP(x
);
110 dummy
= LDBL_MIN
* copysignl(LDBL_MIN
, x
);
111 else if (k
== 0x7fff)
112 dummy
= LDBL_MAX
* copysignl(LDBL_MAX
, x
);