[Bug libstdc++/22542] ostringstream ignores fenv settings (incorrect output)
--- Additional Comments From stefan dot becuwe at ua dot ac dot be 2005-07-18 09:30 --- (In reply to comment #2) > Well, certainly, this is not a libstdc++-v3 bug: internally we are simply > printing floating point numbers using sprintf (or snprintf, when available), > as > mandated by the standard. Actually, however, I'm not at all sure what's the > point of your report: you are changing the rounding mode for floating point > operations, but in the testcase there aren't: there is only the definition of > p (taking place *before* any setround) Ok, I'll reformulate it and I've even simplified the input. 4.5 is exactly representable in double precision, regardless of the active rounding precision. It should always be 4.5. What I would like to do is to have that double precision input rounded to the number of digits given by .precision (1 in the example) using stringstreams, taking into account the rounding mode. In the following example, I assign a value to p AFTER setting the rounding mode. And guess, for the 4 rounding modes I now get 4 instead 5 (in my original post). Although internally the value of p should be 4.5... Again: two of the four cases are wrong... So, as far as I'm concerned, I still think there's an error somewhere. s1.setf(ios::scientific, ios::floatfield); s1.setf(ios::showpoint, ios::floatfield); s1.precision(1); double p; fesetround(FE_TONEAREST); p = 4.5; s1 << p << ends; cout << "s1 = " << s1.str() << endl; -- What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|INVALID | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22542
[Bug libstdc++/22542] ostringstream ignores fenv settings (incorrect output)
--- Additional Comments From stefan dot becuwe at ua dot ac dot be 2005-07-18 08:48 --- Created an attachment (id=9299) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9299&action=view) preprocessed file -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22542
[Bug libstdc++/22542] New: ostringstream ignores fenv settings (incorrect output)
There seems to be a problem when an ostringstream gets its input from, f.i., a double. I've noticed the problem for at least exact halfway cases such as 4.5. In two of the four cases, the output is incorrect. The same behaviour is present in g++ 4.0.0 (prerelease 20050319). -- Summary: ostringstream ignores fenv settings (incorrect output) Product: gcc Version: 3.3.4 Status: UNCONFIRMED Severity: normal Priority: P2 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: stefan dot becuwe at ua dot ac dot be CC: gcc-bugs at gcc dot gnu dot org GCC host triplet: gcc version 3.3.4 (pre 3.3.5 20040809) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22542
[Bug libstdc++/19091] New: problem with string to double conversion (overflow situation)
Following conversion should overflow, and not return 8.02393e-308. Same problem, although different output, when reading "4E308" from standard input. #include #include using namespace std; int main() { double r; istringstream s("+4E308"); s >> r; cout << r << endl; } -- Summary: problem with string to double conversion (overflow situation) Product: gcc Version: 3.3.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: stefan dot becuwe at ua dot ac dot be CC: gcc-bugs at gcc dot gnu dot org GCC host triplet: i386 linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19091