https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277612

            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: b...@freebsd.org
          Reporter: pjfl...@wanadoo.fr

I think that it would be better for compatibility for printf of negative nans
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 — which style is implementation-defined. A double argument
representing a
NaN is converted in one of the styles [-]nan or [-]nan(n-char-sequence) — which
style and 
the meaning of any n-char-sequence, is implementation-defined. The F conversion
specifier
produces INF, INFINITY, or NAN instead of inf, infinity, or nan,
respectively.337)

>From what I see the cod that controls this is

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

in vfprintf.c

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

Reply via email to