From 81ebd8cf8d8a07062d4f2c995ef8f1a44cc42c48 Mon Sep 17 00:00:00 2001 From: F1F88 <0xf1f88@gmail.com> Date: Wed, 22 Apr 2026 22:54:05 +0800 Subject: [PATCH] Supports "%f" formatting value as negative inf float (#2444) --- core/logic/sprintf.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/logic/sprintf.cpp b/core/logic/sprintf.cpp index a6a47fb3..b10f26c1 100644 --- a/core/logic/sprintf.cpp +++ b/core/logic/sprintf.cpp @@ -269,7 +269,8 @@ void AddFloat(char **buf_p, size_t &maxlen, double fval, int width, int prec, in if (ke::IsInfinite(static_cast(fval))) { - AddString(buf_p, maxlen, "Inf", width, prec, flags | NOESCAPE); + const char *str = ((fval < 0) ? "-Inf" : "Inf"); + AddString(buf_p, maxlen, str, width, prec, flags | NOESCAPE); return; }