[PATCH] Fix truncf for sNaN input

Joseph Myers joseph@codesourcery.com
Wed Mar 11 21:47:04 GMT 2020


On Wed, 11 Mar 2020, Keith Packard via Newlib wrote:

> 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?

That manpage is wrong.  The underlying IEEE operation should raise 
"invalid" and return a qNaN for an sNaN operand (but never raises 
"inexact").

-- 
Joseph S. Myers
joseph@codesourcery.com


More information about the Newlib mailing list