public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/14969] New: num_put incorrectly limits output precision
@ 2004-04-15 19:39 austern at apple dot com
2004-04-15 20:14 ` [Bug libstdc++/14969] " pcarlini at suse dot de
0 siblings, 1 reply; 2+ messages in thread
From: austern at apple dot com @ 2004-04-15 19:39 UTC (permalink / raw)
To: gcc-bugs
Consider the following test case:
#include <iostream>
#include <iomanip>
int main()
{
double pi = 3.14159;
std::cout << std::setprecision(40) << pi << std::endl;
}
Compiling and running this program gives the output:
3.1415899999999999 We've got 16 digits after the
decimal point, even though we've requested 40.
There's code in locale_facets.tcc that limits the precision
if it's "out of range". I don't see any justification for
doing that either in clause 22.2.2.2.2 of the C++
standard, which defines the behavior in terms of printf,
or in clause 7.19.6.1 of the C standard, which describes
printf itself. (FWIW the C standard does say that there is
an implementation defined upper limit for printf
conversions, but it is required to be at least 4095.)
--
Summary: num_put incorrectly limits output precision
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: austern at apple dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: powerpc-apple-darwin7.3.0
GCC host triplet: powerpc-apple-darwin7.3.0
GCC target triplet: powerpc-apple-darwin7.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14969
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-04-15 19:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-15 19:39 [Bug libstdc++/14969] New: num_put incorrectly limits output precision austern at apple dot com
2004-04-15 20:14 ` [Bug libstdc++/14969] " pcarlini at suse dot de
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).