From 1efecaef1f867cb218366e2b4ab4b901fdd2835f Mon Sep 17 00:00:00 2001 From: tanaka takashi Date: Sat, 4 Jul 2026 14:54:45 +0900 Subject: 途中経過コミット MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mcp/json.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/mcp/json.c') diff --git a/src/mcp/json.c b/src/mcp/json.c index 62f31c9..59e2395 100644 --- a/src/mcp/json.c +++ b/src/mcp/json.c @@ -1,6 +1,7 @@ #include "mcp/json.h" #include +#include #include #include @@ -172,3 +173,15 @@ tiny_json_i64(tiny_json_buffer_t *buffer, long long value) snprintf(text, sizeof(text), "%lld", value); return tiny_json_raw(buffer, text); } + +bool +tiny_json_number(tiny_json_buffer_t *buffer, double value) +{ + char text[32]; + if (!isfinite(value)) + { + return false; + } + snprintf(text, sizeof(text), "%.17g", value); + return tiny_json_raw(buffer, text); +} -- cgit v1.2.3