From 9789c6e911901a439cddf998a34c4ea88843431b Mon Sep 17 00:00:00 2001 From: F1F88 <0xF1F88@gmail.com> Date: Fri, 30 May 2025 14:22:35 +0800 Subject: [PATCH] Fixed when the float value of "%f" is inf, it should be formatted as "Inf" instead of "0.0" --- core/logic/sprintf.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/logic/sprintf.cpp b/core/logic/sprintf.cpp index 6263ddfb7..c8f69f8b3 100644 --- a/core/logic/sprintf.cpp +++ b/core/logic/sprintf.cpp @@ -254,6 +254,12 @@ void AddFloat(char **buf_p, size_t &maxlen, double fval, int width, int prec, in return; } + if (std::isinf(fval)) + { + AddString(buf_p, maxlen, "Inf", width, prec, flags | NOESCAPE); + return; + } + // default precision if (prec < 0) {