From cb4b3194bcc9f7e6beab2f99660741d34e0b48ad Mon Sep 17 00:00:00 2001 From: matt Date: Thu, 30 Jan 2014 19:06:54 +0000 Subject: [PATCH] unord for float128 long double --- lib/libc/softfloat/unordtf2.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 lib/libc/softfloat/unordtf2.c diff --git a/lib/libc/softfloat/unordtf2.c b/lib/libc/softfloat/unordtf2.c new file mode 100644 index 000000000000..37120d10ceda --- /dev/null +++ b/lib/libc/softfloat/unordtf2.c @@ -0,0 +1,28 @@ +/* $NetBSD: unordtf2.c,v 1.1 2014/01/30 19:06:54 matt Exp $ */ + +/* + * Written by Richard Earnshaw, 2003. This file is in the Public Domain. + */ + +#include "softfloat-for-gcc.h" +#include "milieu.h" +#include "softfloat.h" + +#include +#if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD: unordtf2.c,v 1.1 2014/01/30 19:06:54 matt Exp $"); +#endif /* LIBC_SCCS and not lint */ + +flag __unordtf2(float128, float128); + +flag +__unordtf2(float128 a, float128 b) +{ + /* + * The comparison is unordered if either input is a NaN. + * Test for this by comparing each operand with itself. + * We must perform both comparisons to correctly check for + * signalling NaNs. + */ + return 1 ^ (float128_eq(a, a) & float128_eq(b, b)); +}