Re: [PATCH] Fix truncf for sNaN input

Corinna Vinschen via Newlib <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
On Mar 11 10:58, Fabian Schriever wrote:
> Make line 47 in sf_trunc.c reachable. While converting the double
> precision function trunc to the single precision version truncf an error
> was introduced into the special case. This special case is meant to
> catch both NaNs and infinities, however qNaNs and infinities work just
> fine with the simple return of x (line 51). The only error occurs for
> sNaNs where the same sNaN is returned and no invalid exception is
> raised.
> ---
>  newlib/libm/common/sf_trunc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/newlib/libm/common/sf_trunc.c b/newlib/libm/common/sf_trunc.c
> index 74ea933ce..8eb0554d8 100644
> --- a/newlib/libm/common/sf_trunc.c
> +++ b/newlib/libm/common/sf_trunc.c
> @@ -42,7 +42,7 @@
>      }
>    else
>      {
> -      if (exponent_less_127 == 255)
> +      if (exponent_less_127 == 128)
>          /* x is NaN or infinite. */
>          return x + x;
>  
> -- 
> 2.24.1.windows.2
> 

Pushed.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAl5ox98ACgkQ9TYGna5E
T6CmUA//RdqSwuIvahSe69/OX4KmmwFZH9fIbsVGbusO32IV2dzEKOXUrX5WaThn
PRCitr8DEt9GzssGu5F1UPI1LXHWAkhWrsVyIhGvbW25FUeJm7bFv87sI3V1W4gW
me4T1B8bA+joojulh/4ufLy2mQWYkGcMTphq/APE6CtjHGkL7V79akgEuLUt4tbk
VreOhVI7DJL41hnd1NQlGMi4b4zLwesuklQ8ahCU+NK3FDJPv8AMLZUsxIV/cznb
c5GZ3Q4so9w3ImUqmnIaqVESR1X+43FnguukjKkXLPTV4zs1mqpRQbPLL0rmvtOw
eqjqmXknVc2jncw1P2/jv4niyERQrgLmUq0HYcad701IEEDmR68bB2aN1QHTheu2
8YbACFX1L4lQt38wufpGmJ4yYis5XAAnE3gNaGve0UGc992jKhD4ma8LY6cLlwwM
qB8se5nq+sHJlrvgf1yIbuF4JWluigV3p3/kT/APCLiOy+sfrNEQqXfh8kz4BsOe
YVm7dVOJGUZTjNxZe7LaHsUiQcw/nAfJa1AI02VuZaaDkXnb1A6UFn6V5iMULkuF
Gp+icFWaGpdQwLLdkonh2jKiBsvpYY7cOrBESqbG+mSKVMy1ET2xQhT0He3/lGn7
AHKKTEUIL0CkVvutFFSKMxeFNcsdBEDkhPB/m5JfeESPKNzh7kc=
=WK8V
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.