------- Additional Comments From pcarlini at suse dot de 2005-07-18 09:46 ------- > 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.
Certainly, the C++ standard doesn't mandate anything about the behavior in the presence of those settings (among other things, it's C99 material): the behavior is specified in terms of parameters to an underlying sprintf call. I seem to understand that you want sprintf itself to take into account the rounding mode when carrying out its own rounding. I'm not at all sure that the C standard mandates that (i.e., I'm not at all sure that among the floating point operations affected there is also the rounding internal to sprintf), but in case this is a pure libc issue. -- What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22542