[cairo] Changing %f to %g in cairo-output-stream.c?

Michael Sweet mike at easysw.com
Fri Oct 20 05:07:13 PDT 2006


Adrian Johnson wrote:
> Behdad Esfahbod wrote:
>> Hi,
>>
>> While working on Pango Postscript output from Firefox I noticed that we
>> are using %f to print double values in cairo-output-stream.c.  Shouldn't
>> we be using %g instead?  The difference is that %g generates a shorter
>> representation than %f.  For example, printing 0.3, %g will print 0.3,
>> while %f prints 0.30000.
> 
> cairo-output-stream.c reimplements printf to provide formatting of
> doubles that is independent of the current locale's decimal separator.
> The reimplementation only takes %f and always trims trailing zeros.

Excellent!

-- 
______________________________________________________________________
Michael Sweet, Easy Software Products           mike at easysw dot com
Internet Printing and Publishing Software        http://www.easysw.com


More information about the cairo mailing list