[PATCH] Fix truncf for sNaN input

Joseph Myers joseph@codesourcery.com
Tue Mar 17 22:29:30 GMT 2020


On Tue, 17 Mar 2020, Fabian Schriever wrote:

> On implementations that support the IEC60559: 1989 standard floating point,
> functions with signaling NaN argument(s) shall be treated as if the function
> were called with an argument that is a required domain error and shall return
> a quiet NaN result, except where stated otherwise.

This fails to allow for functions such as fabs where the corresponding 
IEEE operations pass through a signaling NaN rather than returning a quiet 
NaN with "invalid" raised.

Furthermore, TS 18661-1 makes it implementation-defined whether there is a 
domain error.  And in practice it's more convenient for implementations 
not to treat it as a domain error (not to set errno) as that means they 
can just e.g. add a NaN argument to itself rather than rather than 
explicitly testing for a signaling NaN.

-- 
Joseph S. Myers
joseph@codesourcery.com


More information about the Newlib mailing list