public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* reading sNaN
@ 2023-10-10 13:41 Paul Zimmermann
  2023-10-10 14:23 ` Vincent Lefevre
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Zimmermann @ 2023-10-10 13:41 UTC (permalink / raw)
  To: libc-alpha

       Hi,

it seems currently the GNU libc can read the following character sentences
through scanf ("%la", &x) : [+-]nan, [+-]inf, where nan means a quiet NaN.

Is is planned to also read signaling NaNs as [+-]snan?

Paul

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: reading sNaN
  2023-10-10 13:41 reading sNaN Paul Zimmermann
@ 2023-10-10 14:23 ` Vincent Lefevre
  0 siblings, 0 replies; 2+ messages in thread
From: Vincent Lefevre @ 2023-10-10 14:23 UTC (permalink / raw)
  To: libc-alpha

On 2023-10-10 15:41:05 +0200, Paul Zimmermann wrote:
> it seems currently the GNU libc can read the following character sentences
> through scanf ("%la", &x) : [+-]nan, [+-]inf, where nan means a quiet NaN.

But it is buggy as it doesn't support the form with parentheses:

https://sourceware.org/bugzilla/show_bug.cgi?id=30647

> Is is planned to also read signaling NaNs as [+-]snan?

Has this been put in the C23 draft?

FYI, here's what the IEEE 754-2019 says:

  Conversion of an external character sequence “snan” (regardless
  of case) with an optional preceding sign, to a supported format
  should either produce a signaling NaN or else produce a quiet NaN
  and signal the invalid operation exception.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-10 14:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-10 13:41 reading sNaN Paul Zimmermann
2023-10-10 14:23 ` Vincent Lefevre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).