From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18778 invoked by alias); 3 Oct 2002 20:52:52 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 18754 invoked by uid 61); 3 Oct 2002 20:52:52 -0000 Date: Thu, 03 Oct 2002 13:52:00 -0000 Message-ID: <20021003205252.18753.qmail@sources.redhat.com> To: a.b.taylor@sympatico.ca, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, ledermg@mail.mohawkc.on.ca, nobody@gcc.gnu.org, paolo@gcc.gnu.org From: paolo@gcc.gnu.org Reply-To: paolo@gcc.gnu.org, a.b.taylor@sympatico.ca, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, ledermg@mail.mohawkc.on.ca, nobody@gcc.gnu.org, paolo@gcc.gnu.org, gcc-gnats@gcc.gnu.org Subject: Re: libstdc++/8135: fixed and scientfic output with different precisions is inconsistent with standard X-SW-Source: 2002-10/txt/msg00131.txt.bz2 List-Id: Synopsis: fixed and scientfic output with different precisions is inconsistent with standard Responsible-Changed-From-To: unassigned->paolo Responsible-Changed-By: paolo Responsible-Changed-When: Thu Oct 3 13:52:51 2002 Responsible-Changed-Why: Analyzed. State-Changed-From-To: open->closed State-Changed-By: paolo State-Changed-When: Thu Oct 3 13:52:51 2002 State-Changed-Why: Not a bug. Try the following, which compares libstdc++-v3 to the letter of the standard (22.2.2.2.2,8 and 11) #include #include #include using namespace std; const double pi = 3.1415926535, sm = 0.00004321; void experiment(); int main() { experiment(); cout.setf(ios::fixed | ios::scientific, ios::floatfield); experiment(); return 0; } void experiment() { cout << "floatfield:"; ios::fmtflags f = cout.flags(); if (f & ios::fixed) cout << " fixed"; if (f & ios::scientific) cout << " scientific"; cout << endl; for (int x = 0; x < 10; x++) { cout << x << ". " << setprecision(x) << setw(20) << pi << setw(20) << sm; if (x > 0 || (cout.flags() & ios::fixed)) printf("%20.*g%20.*g\n", x, pi, x, sm); else printf("%20g%20g\n", pi, sm); } } http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8135