bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: printf inconsistent results for %.0f


From: Grisha Levit
Subject: Re: printf inconsistent results for %.0f
Date: Tue, 13 Aug 2024 19:05:51 -0400

On Mon, Aug 12, 2024, 11:04 Chet Ramey <chet.ramey@case.edu> wrote:

> My question is why the (admittedly old) gnulib replacement strtod/strtold
> is messing things up.
>

Looks like printf(3) gets called with a `Lf' conversation specifier and a
double argument.

diff --git a/builtins/printf.def b/builtins/printf.def
index 6549e718..d2feaf6b 100644
--- a/builtins/printf.def
+++ b/builtins/printf.def
@@ -782,7 +782,7 @@ printf_builtin (WORD_LIST *list)
                    floatmax_t p;

                    p = getfloatmax ();
-                   f = mklong (start, "L", 1);
+                   f = mklong (start, FLOATMAX_CONV, sizeof FLOATMAX_CONV
- 1);
                    PF (f, p);
                  }
                else /* posixly_correct */


reply via email to

[Prev in Thread] Current Thread [Next in Thread]