Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
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
- is depended upon by
-
STDCXX-464 [HP-UX 11.23] std::num_put drops sign from negative long double NaN
- Resolved