[PATCH 1/2] RISC-V: NaN should return 0 for finite[f]

Corinna Vinschen vinschen@redhat.com
Thu Oct 29 08:41:41 GMT 2020


On Oct 28 23:41, Kito Cheng wrote:
> ---
>  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"
> -- 
> 2.28.0

Both patches pushed.

Sending a cover letter per `git format-patch --cover-letter ...' would
be nice when sending patch series.


Thanks,
Corinna



More information about the Newlib mailing list