Re: [PATCH] Fix truncf for sNaN input
Keith Packard via Newlib <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
Joseph Myers <[email protected]> writes: > I'm referring to 6.2 Operations with NaNs, "Signaling NaNs shall be > reserved operands that signal the invalid operation exception (see 7.2) > for every general-computational and signaling-computational operation > except for the conversions described in 5.12.". I believe you are concerned with the exception behavior, where the original code was wrong. Section 5.9 says that conversion functions signal for sNaN input, while 6.2 says that they deliver a qNaN result. I was concerned with what NaN values are delivered from a NaN operand, given the POSIX specification which says that the operand itself shall be delivered if it is a NaN. I hadn't considered the exception behavior, nor had I realized that sNaN operands cause a qNaN to be delivered. I need to interpret the POSIX spec as saying that a NaN operand will deliver *some* NaN, but not that it will deliver the NaN operand. The functions cannot do this in the case of sNaN operands which must deliver a qNaN according to the IEEE spec. I'll update the newlib tests to verify that sNaN parameters deliver qNaN results, and to allow any qNaN value for a qNaN operand, instead of requiring that the functions return precisely the same qNaN value. Those tests don't currently encode the signal behavior; I'll have to add support for that at some point. Thanks much for your clarifications and pointers to the relevant specs. -- -keith
signature.asc
(application/pgp-signature, 832 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEw4O3eCVWE9/bQJ2R2yIaaQAAABEFAl5v2J4ACgkQ2yIaaQAA ABEZWBAAo86IYFFVKrGtkhAAWpj5uf8rC12QkFWFlcl/lRJxCPaG+8EVM5fHmljc ZKq6SgaGwIUZ4Efyh2Fq+6w9dsapTWqsQY+053/Ip5KDnMr4CMyepzB+5sxGhCm1 5xDSRgfKRRsx+T+WbccJXUMw8hlRXekwywSqjGYCYofdSk4GChaeYAtnGOs/Z87k z75N8YTZTop7SX63NjTXn+FxM/3fuVx/aT8FpVPs/0b8axOSMmrYRXaucBymOuOA ULiSPO+MaeVy5MHa/YHMRVCPUj881J1+OaOdXRWaKegmiLGjIIn+Xq2fcwpFN4K4 nVOOAcKY5mLtO2NM65lpcrwSIvZLD/QBZOZKBdfbMA1NokThvKODTvE0BMIZRV78 jrpC4V/wuBAqjVOOhsoRChubEhJiMbQgpoTvF2GM4oBdtq+XmejreznrH2D1J2ea uTN+cabuSih/qoj9Ah08y4OrUp96CGp141TtRGFXLDjZzv5xrvx4FxzMz3vGNddD dkO7iu2gNbrKNVTftmi/CtREIB19qxXpByakSsK7pznIlBdbFFyT7Kq9qGue9JPZ FSq56Ae4pkN0biG4fWsgRAQsJG4WtchPSQq5TE99sIlQcgO1p16cC6w1pg2G0cUm BHQErBa3w3ikeNxfqe2Pqnnzockiz9ZSRbwBVWT07r448/vzd3s= =7Y4G -----END PGP SIGNATURE-----