public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] RISC-V: NaN should return 0 for finite[f]
@ 2020-10-29  8:39 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2020-10-29  8:39 UTC (permalink / raw)
  To: newlib-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=0020d2dd7c0eedcc19d20edeb7d66006927e202a

commit 0020d2dd7c0eedcc19d20edeb7d66006927e202a
Author: Kito Cheng <kito.cheng@sifive.com>
Date:   Wed Oct 28 23:41:26 2020 +0800

    RISC-V: NaN should return 0 for finite[f]

Diff:
---
 newlib/libm/machine/riscv/s_finite.c  | 2 +-
 newlib/libm/machine/riscv/sf_finite.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/newlib/libm/machine/riscv/s_finite.c b/newlib/libm/machine/riscv/s_finite.c
index f5336e5dc..1f1f2244d 100644
--- a/newlib/libm/machine/riscv/s_finite.c
+++ b/newlib/libm/machine/riscv/s_finite.c
@@ -44,7 +44,7 @@
 int finite(double x)
 {
 	long fclass = _fclass_d (x);
-	return (fclass & FCLASS_INF) == 0;
+	return (fclass & (FCLASS_INF | FCLASS_NAN)) == 0;
 }
 #else
 #include "../../common/s_finite.c"
diff --git a/newlib/libm/machine/riscv/sf_finite.c b/newlib/libm/machine/riscv/sf_finite.c
index f1cf5c6ce..a17b0fa36 100644
--- a/newlib/libm/machine/riscv/sf_finite.c
+++ b/newlib/libm/machine/riscv/sf_finite.c
@@ -41,7 +41,7 @@
 int finitef(float x)
 {
 	long fclass = _fclass_f (x);
-	return (fclass & FCLASS_INF) == 0;
+	return (fclass & (FCLASS_INF | FCLASS_NAN)) == 0;
 }
 #else
 #include "../../common/sf_finite.c"


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-29  8:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-29  8:39 [newlib-cygwin] RISC-V: NaN should return 0 for finite[f] Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).