xref: /minix3/lib/libc/softfloat/unordtf2.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc /* $NetBSD: unordtf2.c,v 1.2 2014/01/30 19:11:41 matt Exp $ */
2*0a6a1f1dSLionel Sambuc 
3*0a6a1f1dSLionel Sambuc /*
4*0a6a1f1dSLionel Sambuc  * Written by Richard Earnshaw, 2003.  This file is in the Public Domain.
5*0a6a1f1dSLionel Sambuc  */
6*0a6a1f1dSLionel Sambuc 
7*0a6a1f1dSLionel Sambuc #include "softfloat-for-gcc.h"
8*0a6a1f1dSLionel Sambuc #include "milieu.h"
9*0a6a1f1dSLionel Sambuc #include "softfloat.h"
10*0a6a1f1dSLionel Sambuc 
11*0a6a1f1dSLionel Sambuc #include <sys/cdefs.h>
12*0a6a1f1dSLionel Sambuc #if defined(LIBC_SCCS) && !defined(lint)
13*0a6a1f1dSLionel Sambuc __RCSID("$NetBSD: unordtf2.c,v 1.2 2014/01/30 19:11:41 matt Exp $");
14*0a6a1f1dSLionel Sambuc #endif /* LIBC_SCCS and not lint */
15*0a6a1f1dSLionel Sambuc 
16*0a6a1f1dSLionel Sambuc #ifdef FLOAT128
17*0a6a1f1dSLionel Sambuc 
18*0a6a1f1dSLionel Sambuc flag __unordtf2(float128, float128);
19*0a6a1f1dSLionel Sambuc 
20*0a6a1f1dSLionel Sambuc flag
__unordtf2(float128 a,float128 b)21*0a6a1f1dSLionel Sambuc __unordtf2(float128 a, float128 b)
22*0a6a1f1dSLionel Sambuc {
23*0a6a1f1dSLionel Sambuc 	/*
24*0a6a1f1dSLionel Sambuc 	 * The comparison is unordered if either input is a NaN.
25*0a6a1f1dSLionel Sambuc 	 * Test for this by comparing each operand with itself.
26*0a6a1f1dSLionel Sambuc 	 * We must perform both comparisons to correctly check for
27*0a6a1f1dSLionel Sambuc 	 * signalling NaNs.
28*0a6a1f1dSLionel Sambuc 	 */
29*0a6a1f1dSLionel Sambuc 	return 1 ^ (float128_eq(a, a) & float128_eq(b, b));
30*0a6a1f1dSLionel Sambuc }
31*0a6a1f1dSLionel Sambuc 
32*0a6a1f1dSLionel Sambuc #endif /* FLOAT128 */
33