// Presentation types for integral types (including bool and charT).
_Pres_d = 1, _Pres_b, _Pres_B, _Pres_o, _Pres_x, _Pres_X, _Pres_c,
// Presentation types for floating-point types.
- _Pres_a = 1, _Pres_A, _Pres_e, _Pres_E, _Pres_f, _Pres_g, _Pres_G,
+ _Pres_a = 1, _Pres_A, _Pres_e, _Pres_E, _Pres_f, _Pres_F, _Pres_g, _Pres_G,
_Pres_p = 0, _Pres_P, // For pointers.
_Pres_s = 0, // For strings and bool.
_Pres_esc = 0xf, // For strings and charT.
++__first;
break;
case 'f':
- case 'F':
__spec._M_type = _Pres_f;
++__first;
break;
+ case 'F':
+ __spec._M_type = _Pres_F;
+ ++__first;
+ break;
case 'g':
__spec._M_type = _Pres_g;
++__first;
__use_prec = true;
__fmt = chars_format::scientific;
break;
+ case _Pres_F:
+ __upper = true;
+ [[fallthrough]];
case _Pres_f:
__use_prec = true;
__fmt = chars_format::fixed;
VERIFY( s == "1.e+01 1.e+01 1.e+01" );
}
+void
+test_infnan()
+{
+ double inf = std::numeric_limits<double>::infinity();
+ double nan = std::numeric_limits<double>::quiet_NaN();
+ std::string s;
+ s = std::format("{0} {0:e} {0:E} {0:f} {0:F} {0:g} {0:G} {0:a} {0:A}", inf);
+ VERIFY( s == "inf inf INF inf INF inf INF inf INF" );
+ s = std::format("{0} {0:e} {0:E} {0:f} {0:F} {0:g} {0:G} {0:a} {0:A}", nan);
+ VERIFY( s == "nan nan NAN nan NAN nan NAN nan NAN" );
+}
+
struct euro_punc : std::numpunct<char>
{
std::string do_grouping() const override { return "\3\3"; }