Fixed when the float value of "%f" is inf, it should be formatted as "Inf" instead of "0.0"

This commit is contained in:
F1F88 2025-05-30 14:22:35 +08:00
parent 7e784d5453
commit 9789c6e911

View File

@ -254,6 +254,12 @@ void AddFloat(char **buf_p, size_t &maxlen, double fval, int width, int prec, in
return; return;
} }
if (std::isinf(fval))
{
AddString(buf_p, maxlen, "Inf", width, prec, flags | NOESCAPE);
return;
}
// default precision // default precision
if (prec < 0) if (prec < 0)
{ {