Joseph Myers <jos...@codesourcery.com> wrote:
> On Fri, 6 Aug 2021, Stefan Kanthak wrote: PLEASE DON'T STRIP ATTRIBUTION LINES: I did not write the following paragraph! >> > I don't know what the standard says about NaNs in this case, I seem to >> > remember that arithmetic instructions typically produce QNaN when one of >> > the inputs is a NaN, whether signaling or not. >> >> <https://pubs.opengroup.org/onlinepubs/9699919799/functions/trunc.html> >> and its cousins as well as the C standard say >> >> | If x is NaN, a NaN shall be returned. >> >> That's why I mentioned that the code GCC generates also doesn't quiet SNaNs. > > You should be looking at TS 18661-3 / C2x Annex F for sNaN handling; I'll do so as soon as GCC drops support for all C dialects before C2x! Unless you use a time machine and fix the POSIX and ISO C standards written in the past you CAN'T neglect all software written before C2x modified sNaN handling that relies on the documented behaviour at the time it was written. > the POSIX attempts to deal with signaling NaNs aren't well thought out. [...] > Though in C2x mode, these SSE2 code sequences won't be used by default > anyway, except for rint (C2x implies -fno-fp-int-builtin-inexact). regards Stefan