auto s = std::format("{.2f}", x);
std::array<char, 23> buffer;
std::string s{};
if (auto [ptr, ec] = std::to_chars(buffer.data(), buffer.data() + buffer.size(), x, std::chars_format::fixed, 2); ec == std::errc{}) {
s = std::string(buffer.data(), ptr);
} else {
s = std::make_error_code(ec).message();
}
std::stringstream ss;
ss << std::fixed << std::setprecision(2) << x;
s = ss.str();
string str = format("%.2s", x);
var s = x.toStringAsFixed(2);
s = Float.to_string(x, decimals: 2)
S = io_lib:format("~.2f", [X]).
write (unit=s,fmt="(F20.2)") x
s := fmt.Sprintf("%.2f", x)
s <- showFFloat (Just 2) x ""
String s = String.format("%.2f", x);
MathContext m = new MathContext(3, HALF_UP);
BigDecimal d = new BigDecimal(x, m);
String s = d.toPlainString();
BigDecimal d = new BigDecimal(x);
String s = "%.2f".formatted(d);
String s = "%.2f".formatted(x);
NumberFormat f = getNumberInstance();
f.setRoundingMode(HALF_UP);
f.setMaximumFractionDigits(2);
String s = f.format(x);
s = string.format("%.2f",x)
$s = sprintf('%.2f', $x);
s := format('%.2f',[ x]);
let s = format!("{:.2}", x);