Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Mar 2024 13:55:41 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 277612] libc printf not compatible with glibc with negative nan
Message-ID:  <bug-277612-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D277612

            Bug ID: 277612
           Summary: libc printf not compatible with glibc with negative
                    nan
           Product: Base System
           Version: 14.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: misc
          Assignee: bugs@FreeBSD.org
          Reporter: pjfloyd@wanadoo.fr

I think that it would be better for compatibility for printf of negative na=
ns
to include the minus sign.

The C standard does say

A double argument representing an infinity is converted in one of the styles
[-]inf or
[-]infinity =E2=80=94 which style is implementation-defined. A double argum=
ent
representing a
NaN is converted in one of the styles [-]nan or [-]nan(n-char-sequence) =E2=
=80=94 which
style and=20
the meaning of any n-char-sequence, is implementation-defined. The F conver=
sion
specifier
produces INF, INFINITY, or NAN instead of inf, infinity, or nan,
respectively.337)

>From what I see the cod that controls this is

=E2=94=82  >   785                          if (expt =3D=3D INT_MAX) {  /* =
inf or nan */
=E2=94=82      786                                  if (*cp =3D=3D 'N') {
=E2=94=82      787                                          cp =3D (ch >=3D=
 'a') ? "nan" :
"NAN";
=E2=94=82      788                                          sign =3D '\0';

in vfprintf.c

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-277612-227>