From 22cc68808c31e15c7455ce6056f5be4e8226e8e1 Mon Sep 17 00:00:00 2001 From: F1F88 <0xf1f88@gmail.com> Date: Sun, 9 Nov 2025 00:32:09 +0800 Subject: [PATCH] Supports "%f" formatting value as inf float (#2324) * Fixed when the float value of "%f" is inf, it should be formatted as "Inf" instead of "0.0" * Replace std::isinf with ke::IsInfinite --- core/logic/sprintf.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/logic/sprintf.cpp b/core/logic/sprintf.cpp index 6263ddfb7..b872194f7 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 (ke::IsInfinite(static_cast(fval))) + { + AddString(buf_p, maxlen, "Inf", width, prec, flags | NOESCAPE); + return; + } + // default precision if (prec < 0) {