4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 1994-1997, by Sun Microsystems, Inc.
24 * All rights reserved.
27 #pragma ident "%Z%%M% %I% %E% SMI"
32 #define _Q_cmpe _Qp_cmpe
36 * _Q_cmpe(x, y) returns the condition code that would result from
37 * fcmpeq *x, *y (and raises the same exceptions).
40 _Q_cmpe(const union longdouble
*x
, const union longdouble
*y
)
42 unsigned int xm
, ym
, fsr
;
44 if (QUAD_ISNAN(*x
) || QUAD_ISNAN(*y
)) {
45 /* nan, signal invalid */
48 __quad_fcmpeq(x
, y
, &fsr
);
49 return ((fsr
>> 10) & 3);
51 fsr
= (fsr
& ~FSR_CEXC
) | FSR_NVA
| FSR_NVC
;
54 return (fcc_unordered
);
57 /* ignore sign of zero */
65 if ((xm
^ ym
) & 0x80000000) /* x and y have opposite signs */
66 return ((ym
& 0x80000000)? fcc_greater
: fcc_less
);
68 if (xm
& 0x80000000) {
73 if (x
->l
.frac2
> y
->l
.frac2
)
75 if (x
->l
.frac2
< y
->l
.frac2
)
77 if (x
->l
.frac3
> y
->l
.frac3
)
79 if (x
->l
.frac3
< y
->l
.frac3
)
81 if (x
->l
.frac4
> y
->l
.frac4
)
83 if (x
->l
.frac4
< y
->l
.frac4
)
91 if (x
->l
.frac2
< y
->l
.frac2
)
93 if (x
->l
.frac2
> y
->l
.frac2
)
95 if (x
->l
.frac3
< y
->l
.frac3
)
97 if (x
->l
.frac3
> y
->l
.frac3
)
99 if (x
->l
.frac4
< y
->l
.frac4
)
101 if (x
->l
.frac4
> y
->l
.frac4
)
102 return (fcc_greater
);