xref: /minix3/lib/libc/softfloat/unorddf2.c (revision 2fe8fb192fe7e8720e3e7a77f928da545e872a6a)
1*2fe8fb19SBen Gras /* $NetBSD: unorddf2.c,v 1.1 2003/05/06 08:58:19 rearnsha Exp $ */
2*2fe8fb19SBen Gras 
3*2fe8fb19SBen Gras /*
4*2fe8fb19SBen Gras  * Written by Richard Earnshaw, 2003.  This file is in the Public Domain.
5*2fe8fb19SBen Gras  */
6*2fe8fb19SBen Gras 
7*2fe8fb19SBen Gras #include "softfloat-for-gcc.h"
8*2fe8fb19SBen Gras #include "milieu.h"
9*2fe8fb19SBen Gras #include "softfloat.h"
10*2fe8fb19SBen Gras 
11*2fe8fb19SBen Gras #include <sys/cdefs.h>
12*2fe8fb19SBen Gras #if defined(LIBC_SCCS) && !defined(lint)
13*2fe8fb19SBen Gras __RCSID("$NetBSD: unorddf2.c,v 1.1 2003/05/06 08:58:19 rearnsha Exp $");
14*2fe8fb19SBen Gras #endif /* LIBC_SCCS and not lint */
15*2fe8fb19SBen Gras 
16*2fe8fb19SBen Gras flag __unorddf2(float64, float64);
17*2fe8fb19SBen Gras 
18*2fe8fb19SBen Gras flag
__unorddf2(float64 a,float64 b)19*2fe8fb19SBen Gras __unorddf2(float64 a, float64 b)
20*2fe8fb19SBen Gras {
21*2fe8fb19SBen Gras 	/*
22*2fe8fb19SBen Gras 	 * The comparison is unordered if either input is a NaN.
23*2fe8fb19SBen Gras 	 * Test for this by comparing each operand with itself.
24*2fe8fb19SBen Gras 	 * We must perform both comparisons to correctly check for
25*2fe8fb19SBen Gras 	 * signalling NaNs.
26*2fe8fb19SBen Gras 	 */
27*2fe8fb19SBen Gras 	return 1 ^ (float64_eq(a, a) & float64_eq(b, b));
28*2fe8fb19SBen Gras }
29