[Bug libstdc++/114862] std::uppercase not applying to nan's and inf's

2024-04-30 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114862

--- Comment #3 from Jonathan Wakely  ---
I've opened https://cplusplus.github.io/LWG/issue4084

[Bug libstdc++/114862] std::uppercase not applying to nan's and inf's

2024-04-26 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114862

--- Comment #2 from Jonathan Wakely  ---
Libc++ has tests for "INF" (although only for long double, not float or
double), so it's apparently not accidental. The relevant code is:

  if (floatfield == ios_base::fixed) {
if (uppercase)
  *__fmtp = 'F';
else
  *__fmtp = 'f';

That's been there since the initial commit in 2010.

MSVC behaves the same as libstdc++.

[Bug libstdc++/114862] std::uppercase not applying to nan's and inf's

2024-04-26 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114862

--- Comment #1 from Jonathan Wakely  ---
Actually I think we're doing exactly what the standard requires:

ios_base::fmtflags __fltfield = __flags & ios_base::floatfield;
...
// [22.2.2.2.2] Table 58
if (__fltfield == ios_base::fixed)
  *__fptr++ = 'f';


when (flags & ios_base::floatfield) == ios_base::fixed the conversion specifier
is %f and uppercase is not considered. There is no way to use a conversion
specifier of %F with std::num_put. That seems odd, but it's what the standard
says.

Libc++ does what you expect, which seems to be non-conforming.

I don't see any library issues about this, so I'll talk to the committee.

[Bug libstdc++/114862] std::uppercase not applying to nan's and inf's

2024-04-26 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114862

Jonathan Wakely  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2024-04-26
 Status|UNCONFIRMED |NEW