[PATCH] Fix truncf for sNaN input

Keith Packard keithp@keithp.com
Tue Mar 17 04:04:27 GMT 2020


Joseph Myers <joseph@codesourcery.com> writes:

> I don't think POSIX specifications should be trusted for how functions 
> should behave with sNaN inputs.  Rather, prefer the specifications from TS 
> 18661-1 (or the latest C2x draft which has TS 18661-1 integrated).

From my reading of that, I should only check for signaling vs quiet NaN,
ensuring that values are the right kind of NaN, but not any specific
value of NaN.

I've adjusted the newlib tests like this:

  /* All signaling nans are the "same", as are all quiet nans */
  if (isnan(correct.value) && isnan(is)
      && (issignaling(correct.value) == issignaling(is)))
  {
	/* PASS */
  }

Does this seem correct?

-- 
-keith
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20200316/3d126a0f/attachment.sig>


More information about the Newlib mailing list