bug-gnulib
[Top][All Lists]
Advanced

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

Re: glibc's snprintf is a pig; fix or replace ?


From: Bruno Haible
Subject: Re: glibc's snprintf is a pig; fix or replace ?
Date: Thu, 18 Nov 2010 22:13:50 +0100
User-agent: KMail/1.9.9

Jim Meyering wrote:
> floating point can be tricky; for some values,
> you may need additional space for multiple-precision arithmetic
> to determine the precise width of the printed representation.

Looking at the code we have in lib/vasnprintf.c I believe the
amount of additional space needed is O(e_max) + O(m)
where e_max is the largest absolute value of an exponent, and
m is the largest possible mantissa length of a floating-point number.
Which means, it should be possible to do this within 1 KB or 2 KB
of stack space for 'double', but it's impossible for 'long double'
on IA-64 which has an exponent range from -16382..16383.

Bruno



reply via email to

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