http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49048
Summary: setprecision rounding fails in some cases Product: gcc Version: unknown Status: UNCONFIRMED Severity: major Priority: P3 Component: libstdc++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: s.ceci...@gmail.com cecilio@pp1:~$ gcc --version gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3 I'm having problems with truncation. For instance, following code: cout << "test precision 5798.12500: " << fixed << setprecision(2) << setfill(' ') << setw(10) << 5798.12500 << endl; cout << "test precision 5798.87500: " << fixed << setprecision(2) << setfill(' ') << setw(10) << 5798.87500 << endl; Generates inconsistent results: 5798.12 (wrong, should be 5798.13) and 5798.88 (right). In first case rounds up and in second, down. The same code, compiled with Microsft Visual Studio, produces the right results in the same machine.