From stdcxx-dev-return-3628-apmail-incubator-stdcxx-dev-archive=incubator.apache.org@incubator.apache.org Tue Jun 05 14:38:48 2007 Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 10008 invoked from network); 5 Jun 2007 14:38:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Jun 2007 14:38:46 -0000 Received: (qmail 77251 invoked by uid 500); 5 Jun 2007 14:38:50 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 77190 invoked by uid 500); 5 Jun 2007 14:38:50 -0000 Mailing-List: contact stdcxx-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-dev@incubator.apache.org Received: (qmail 77178 invoked by uid 99); 5 Jun 2007 14:38:50 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Jun 2007 07:38:50 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Jun 2007 07:38:46 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id F0BC7714186 for ; Tue, 5 Jun 2007 07:38:25 -0700 (PDT) Message-ID: <15398487.1181054305974.JavaMail.jira@brutus> Date: Tue, 5 Jun 2007 07:38:25 -0700 (PDT) From: "Farid Zaripov (JIRA)" To: stdcxx-dev@incubator.apache.org Subject: [jira] Resolved: (STDCXX-2) [MSVC] std::num_put bad formatting of 0.0 with precision and showpoint MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/STDCXX-2?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Farid Zaripov resolved STDCXX-2. -------------------------------- Resolution: Won't Fix The problem in the MSVC CRT. The expression strm << 0.0; is invokes the __rw_put_num() function, where used the CRT function snprintf() (num_put.cpp, line 752): snprintf (buf, size, "%#.2lg", 0.0); The result of the snprintf() call above is: "0.00". Info from MSDN: ----------------------------- Flag '#' means: When used with the g or G format, the # flag forces the output value to contain a decimal point in all cases and prevents the truncation of trailing zeros. The precision (".2") means: The precision specifies the maximum number of significant digits printed. ----------------------------- The prefix 'l' before type character 'g' here should point to the long double type, but passed double number (0.0). Anyway this is not causes any problem because of the types double and long double have the same internal representation on the MSVC. > [MSVC] std::num_put bad formatting of 0.0 with precision and showpoint > ---------------------------------------------------------------------- > > Key: STDCXX-2 > URL: https://issues.apache.org/jira/browse/STDCXX-2 > Project: C++ Standard Library > Issue Type: Bug > Components: 22. Localization > Affects Versions: 4.1.2 > Environment: Windows/MSVC > Reporter: Martin Sebor > Assignee: Farid Zaripov > > When compiled with MSVC (any version), the program below aborts at runtime. > $ cat t.cpp && cl -D_RWCONFIG=11s_msvc_7_1 -Ic:/contrib/cygwin/build/sebor/dev-hal/include -I./../../../../include -Ic:/contrib/cygwin/build/sebor/dev-hal/examples/stdlib/manual/../include -Ic:/contrib/cygwin/build/sebor/dev-hal/include/ansi -I./../../../.. > -Ic:/contrib/cygwin/build/sebor/dev-hal -Ic:/contrib/cygwin/build/sebor/dev-hal/examples/stdlib/manual -I. -nologo -GX -MLd -W3 -Zi -GA -GR -GF -GZ -c t.cpp && link -nologo /NODEFAULTLIB:libcpd /debug /LIBPATH:./../../../../lib /OUT:t.exe t.obj std11s_msvc_7_1.lib user32.lib t.cpp && ./t.exe > #include > #include > int main () > { > std::ostringstream strm; > strm.setf (strm.showpoint); > strm.precision (2); > strm << 0.0; > assert ("0.0" == strm.str ()); > } > Assertion failed: "0.0" == strm.str (), file t.cpp, line 13 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.