|
From: | Paul Jarc |
Subject: | [bug-gnulib] Re: length of dec. representation of a number |
Date: | Thu, 10 Mar 2005 00:17:50 -0500 |
User-agent: | Gnus/5.110003 (No Gnus v0.3) Emacs/21.4 (gnu/linux) |
Paul Eggert <address@hidden> wrote: > /* Bound on length of the string representing an integer value or type T. > Subtract 1 for the sign bit if t is signed; log10 (2.0) < 146/485; > add 1 for integer division truncation; add 1 more for a minus sign > if needed. */ > #define INT_STRLEN_BOUND(t) \ > ((sizeof (t) * CHAR_BIT - 1) * 146 / 485 + 2) I guess that should be: #define INT_STRLEN_BOUND(t) \ ((sizeof (t) * CHAR_BIT - TYPE_SIGNED(t)) * 146 / 485 + TYPE_SIGNED(t) + 1) paul
[Prev in Thread] | Current Thread | [Next in Thread] |