Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-463

[HP-UX 11.23] printf("%Lg", -NAN) formatted incorrectly

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: External
    • Labels:
      None
    • Environment:

      HP-UX 11.23 and prior

      Description

      -------- Original Message --------
      Subject: HP-UX 11.23 printf("%Lg", -NAN) formatted incorrectly
      Date: Thu, 28 Jun 2007 19:34:32 -0600
      From: Martin Sebor <sebor@roguewave.com>
      Organization: Rogue Wave Software
      To: acxx@cup.hp.com

      Hi,

      On 11.23/PA, printf("%g") formats negative NaN correctly (by
      prepending the minus) but with "%Lg" it forgets the sign. On
      11.31/IPF printf() works correctly. Are there plans to backport
      the fix to prior versions of HP-UX and/or PA?

      Thanks
      Martin

      $ cat t.cpp && aCC -AA t.cpp && ./a.out
      #include <assert.h>
      #include <stdio.h>
      #include <string.h>
      #include <limits>

      int main ()
      {
      char nan [32];
      char nnan [32];
      char lnan [32];
      char nlnan [32];

      sprintf (nan, "%g", std::numeric_limits<double>::quiet_NaN ());
      sprintf (nnan, "%g", -std::numeric_limits<double>::quiet_NaN ());

      sprintf (lnan, "%Lg", std::numeric_limits<long double>::quiet_NaN ());
      sprintf (nlnan, "%Lg", -std::numeric_limits<long double>::quiet_NaN ());

      printf ("%s, %s\n%s, %s\n", nan, nnan, lnan, nlnan);
      assert (0 == strcmp (nan, lnan));
      assert (0 == strcmp (nnan, nlnan));
      }
      nan, -nan
      nan, nan
      Assertion failed: 0 == strcmp (nnan, nlnan), file t.cpp, line 21
      ABORT instruction (core dumped)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                sebor Martin Sebor
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated: