This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit a61fc6de54834353a22e2db77dba5c99b8da6edf Author: Marco Casaroli <[email protected]> AuthorDate: Thu Nov 5 06:51:55 2026 +0100 libs/libc/stream: Take a precision of 0 as 1 for %g. The C standard takes a precision of 0 as 1 for %g. printf() asked __dtoa_engine() for 0 digits, and "%.0g" of 1.5 printed a NUL byte and "e+00". Ask for 1 digit. Part of https://github.com/apache/nuttx/issues/21467 Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]> --- libs/libc/stream/lib_libvsprintf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/libc/stream/lib_libvsprintf.c b/libs/libc/stream/lib_libvsprintf.c index d1b83053701..d19e11ed603 100644 --- a/libs/libc/stream/lib_libvsprintf.c +++ b/libs/libc/stream/lib_libvsprintf.c @@ -692,7 +692,7 @@ flt_oper: } else { - ndigs = prec; + ndigs = prec != 0 ? prec : 1; ndecimal = 0; }
