stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Sebor (JIRA)" <>
Subject [jira] Created: (STDCXX-463) [HP-UX 11.23] printf("%Lg", -NAN) formatted incorrectly
Date Fri, 29 Jun 2007 01:42:04 GMT
[HP-UX 11.23] printf("%Lg", -NAN) formatted incorrectly

                 Key: STDCXX-463
             Project: C++ Standard Library
          Issue Type: Bug
          Components: External
         Environment: HP-UX 11.23 and prior
            Reporter: Martin Sebor

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


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?


$ 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)

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message