stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeremy Dean (JIRA)" <>
Subject [jira] Created: (STDCXX-461) Error in formatting of infinity
Date Mon, 25 Jun 2007 23:15:25 GMT
Error in formatting of infinity 

                 Key: STDCXX-461
             Project: C++ Standard Library
          Issue Type: Bug
          Components: 27. Input/Output
            Reporter: Jeremy Dean
            Priority: Minor

referrenced in e-mail thread:

But the test program does demonstrate a real problem, and that is the formatting of infinity
when the stream precision is greater than 7. It looks as though the num_put facet inserts
the string "inf\0\0ity" into the stream rather than "inf".

$ cat u.cpp && make u && ./u | od -c
#include <cassert>
#include <iostream>
#include <sstream>

int main () {
     std::ostringstream s;
     s.precision (8);
     s << 1 / 0.0;
     std::cout << s.str () << '\n';
     assert (s.str () == "inf");
gcc -c -I/build/sebor/stdcxx/include/ansi -D_RWSTDDEBUG -D_RWSTD_USE_CONFIG -I/build/sebor/stdcxx/include
-I/build/sebor/stdcxx/examples/include  -pedantic -nostdinc++ -g  -W 
-Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long   u.cpp
u.cpp: In function 'int main()':
u.cpp:8: warning: division by zero in '1 / 0.'
gcc u.o -o u  -L/build/sebor/stdcxx-gcc-4.1.0-11s/lib  -lstd11s -lsupc++ -lm Assertion failed:
s.str () == "inf", file u.cpp, line 10
0000000   i   n   f  \0  \0   i   t   y  \n

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message