Re: [PATCH] Fix truncf for sNaN input
Keith Packard via Newlib <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
Fabian Schriever <[email protected]> writes: > 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. I think this isn't right. According to the trunc/truncf man page: If x is integral, infinite, or NaN, x itself is returned. I think this means that we should just return x in these cases, and not raise an exception? The same appears to be true for the other similar functions, including floor, ceil, round, rint and nearbyint. -- -keith
signature.asc
(application/pgp-signature, 832 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEw4O3eCVWE9/bQJ2R2yIaaQAAABEFAl5pTpoACgkQ2yIaaQAA ABFA3hAAnYmhe/t1+Jb64geaX9FiBXZ3Lhhj2JPLy5MWCrk4CPXF2ErcBWBch0F0 WbGHVsuMwmgllFO2Ts3Mb78YCOgXoiAXKea43JW75QlhQD76PCbQFlBgfsMIjTnT lg2b5eU2h2+4eeQU1gztqj0T/cTNJn+FDvzKGYfjXkLSkENY8Bvw6JP31G/pooW9 jKuLOFLybpdYuOrXEJfT63Eo2jAatzGcBoZ+uCKow9wywCY9rzkhubsRXBz4utDy aEV3KaLQwDrpb/wIFIenRMAxt5FLphLMUXbRr7jCnL+YOkiRtQLdrYB7pNI0PZdf jM8tjAYzNlPtLgRAxIsdxR9Slj3bj0iNEFCz+Oc9/0dkxLg6I83JOiQvoJTvaWWs mD1YMOodRxdRZnIQXhzCSJTJ7J9YFItzkEuYh9leDPfm9IsprRTVvz/AC6Utf114 YI10qEO8JDI6ugHivOj0RBhmzTSFQCOt1zwPA+KtF8znhritr1Js6HMQlVT12E27 IXqS8UcEE5SS9poL8BFRLuRLfEbzi2iy5ddo++NV2oiqkNLHwVGOPUXuhdZNvLDo bu+NHWPeZb2O14x6B5NdCEn3A0iDCu3peHtbgG6Tw+WESTTrq5n3jhx0FOvALMtL 93VIhy+LJFY2jz5a3rH2ubi0ntAwVyIBqK3GUJqxStWEsv7lSaM= =Iw5Q -----END PGP SIGNATURE-----