public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/9548: 64-bit copiling/linking: incorrect results from setf(ios::fixed) or precision(-1)
@ 2003-02-03 23:41 paolo
0 siblings, 0 replies; 3+ messages in thread
From: paolo @ 2003-02-03 23:41 UTC (permalink / raw)
To: axiong, gcc-bugs, gcc-prs, nobody, paolo
Synopsis: 64-bit copiling/linking: incorrect results from setf(ios::fixed) or precision(-1)
Responsible-Changed-From-To: unassigned->paolo
Responsible-Changed-By: paolo
Responsible-Changed-When: Mon Feb 3 23:41:49 2003
Responsible-Changed-Why:
Fixing.
State-Changed-From-To: open->analyzed
State-Changed-By: paolo
State-Changed-When: Mon Feb 3 23:41:49 2003
State-Changed-Why:
According to 22.2.2.2.2 p11, if (flags & fixed) != 0 then
str.precision() is specified in the conversion
specification, even when str.precision is <= 0. Admittedly,
this is quite a weird situation, which triggers a bug
in the current library: it prepares a "%.*f" format
but then calls snprintf without passing the precision field.
Instead of fixing the bug, I'm going to implement the
resolution of DR231, which is in the "Ready" state:
according to it str.precision is simply _always_ specified
in the conversion specification.
Thanks for your report,
Paolo.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9548
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: libstdc++/9548: 64-bit copiling/linking: incorrect results from setf(ios::fixed) or precision(-1)
@ 2003-02-03 18:26 axiong
0 siblings, 0 replies; 3+ messages in thread
From: axiong @ 2003-02-03 18:26 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR libstdc++/9548; it has been noted by GNATS.
From: axiong@ca.ibm.com
To: gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org
Cc:
Subject: Re: libstdc++/9548: 64-bit copiling/linking: incorrect results from setf(ios::fixed) or
precision(-1)
Date: Mon, 3 Feb 2003 13:25:16 -0500
=> The C++ source code which was not attached successfully
/*********************************************************************/
#include <iostream>
using namespace std;
int main()
{
cout.setf(ios::fixed);
cout.precision (-1); // set precision to -1
cout << "Output 30.5 as: " << 30.5 << "\n";
return 0;
}
/**********************************************************************/
^ permalink raw reply [flat|nested] 3+ messages in thread
* libstdc++/9548: 64-bit copiling/linking: incorrect results from setf(ios::fixed) or precision(-1)
@ 2003-02-03 18:16 axiong
0 siblings, 0 replies; 3+ messages in thread
From: axiong @ 2003-02-03 18:16 UTC (permalink / raw)
To: gcc-gnats
>Number: 9548
>Category: libstdc++
>Synopsis: 64-bit copiling/linking: incorrect results from setf(ios::fixed) or precision(-1)
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Feb 03 18:16:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Guan-Zhu (Andrew) Xiong
>Release: gcc version 3.2
>Organization:
>Environment:
Linux Version 2.4.19
SuSE SLES 8 (ppc) - Kernel 2.4.19-ul1-ppc64-SMP (31)
>Description:
=> for 64-bit g++ compiling/linking:
"cout.setf(ios::fixed); cout.precision (-1);"
does not work as expected.
=> For the given C++ code, after 64-bit g++ compiling,
if you run it then you will get output:
-----------------
Output 30.5 as: 30
The correct output should be:
-----------------
Output 30.5 as: 30.500000
=> Refenece: ISO C++ standard
The value passed to precision(int i) must be greater
than zero. If the value is negative the floating point
insertion operators will use the default value
which is 6.
>How-To-Repeat:
1) Compile the given code with "g++ 64-bit compiler"
- e.g., /opt/cross/bin/powerpc64-linux-g++ -o hello x.C
2) Run it - hello
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-02-03 23:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-03 23:41 libstdc++/9548: 64-bit copiling/linking: incorrect results from setf(ios::fixed) or precision(-1) paolo
-- strict thread matches above, loose matches on Subject: below --
2003-02-03 18:26 axiong
2003-02-03 18:16 axiong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).