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 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
signature.asc (application/pgp-signature, 832 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEw4O3eCVWE9/bQJ2R2yIaaQAAABEFAl5wTEwACgkQ2yIaaQAA
ABGBjxAAiKLu4ufxXS8XAbreHjde0iaSoTxAykxjeFJF+VN9ZyVJQpT7Z258jbJD
Th0RYyrKXwxRSCYpw47wP2KbrmBRF1yqNZM1/FWiOMsgO99iG9WVAJucjAa5T8Aj
enWW1XVxSAUCjUVkTQ28UYcZGk4gmb8dx29mhr8rGdj9zfHyEKP1JGQtW0wWG/sb
5K+ZIpmyBkKgjglrJ0oAa+nbKE+2PBqmV6YxaKr07E9pRTWMEcgyfMD55g+vwwgy
qyqQsasZmKbpdlJvRnIQNwDiiJjCvtPI6hHSUUY3JOCo4wPiRIskHkt61pAu7cOx
VTzOpTPVSgph3OPvy5do26/O2nZPvaZ/I+IFxDRGPA9eVrVFCoQex7iVLuB4kpo+
2fG5NHH1fQ68u9xIrWFibecQCiisZSCH/bl40FYTjP7KZjHdvf1Tt30gSZ7rhIjr
sNFS43DnW1PmILyfybcp5O7/HjQcONv3mG12NQzBZbgB/nvvCsmHeBG8p79rVhln
4olfkJJPryOChCWj4JIexUAc9ma8/vM3xMa1F69hMXbQ/jN2IrwImhwJL1ydp7eE
mB31YE8wVLbqlxbM7RPRdLzczpHh+QTn0wGycrnpfKI25vDP/H0XXTYN4DSgzS7N
ciQKPl53QnE3IpDieCgrSNlNJnZZ/BLwj8wpUhkGtM3xuel4ENQ=
=0hqS
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.