cvs commit: src/lib/libc/stdio floatio.h vfprintf.c

David Schultz das at freebsd.org
Sun Apr 6 17:45:45 PDT 2003


On Sun, Apr 06, 2003, Tim Robbins wrote:
> On Sat, Apr 05, 2003 at 02:11:42PM -0800, David Schultz wrote:
> 
> > das         2003/04/05 14:11:42 PST
> > 
> >   FreeBSD src repository
> > 
> >   Modified files:
> >     lib/libc/stdio       floatio.h vfprintf.c 
> >   Log:
> >   Rework the floating point code in printf().  Significant changes:
> >   
> >   - We used to round long double arguments to double.  Now we print
> >     them properly.
> >   
> >   - Bugs involving '%F', corner cases of '#' and 'g' format
> >     specifiers, and the '.*' precision specifier have been
> >     fixed.
> >   
> >   - Added support for the "'" specifier to print thousands' grouping
> >     characters in a locale-dependent manner.
> >   
> >   - Implement the __vfprintf() side of hexadecimal floating point
> >     support.  All that is still needed is a routine to convert the
> >     mantissa to hex digits one nibble at a time in the style of ultoa().
> 
> I think there is a bug here. I've attached a small test program that mimics
> the behaviour of top's "CPU states" display. Here are the results on 4.x:
[...]
> 	for (i = 0; i < 150; i += 10)
> 		printf(i >= 100 ? "CPU states: %4.0f%%\n" :
> 		    "CPU states: %4.1f%% user\n", (double)i);

Oops!  I have just checked in a fix for the problem.  It was a
little bit tricky due to the handling of thousands' grouping.
Thanks for pointing this out.


More information about the cvs-src mailing list