[cairo] Bug in PDF output with independent path/pen transformations
Chris Wilson
chris at chris-wilson.co.uk
Wed Oct 31 13:51:03 PDT 2007
Behdad Esfahbod (behdad at behdad.org) said:
> So, I pushed %.18f and then Adrian made it smarter by using %f if number
> is > 0.1 and otherwise %.18f, then prune it to have only 6 meaningful
> digits.
>
> I suggest we refine it further:
>
> - 18 digits is still not enough to write a number like 7e-100. What
> we really want is up to a large number of digits (100?), but only 5 6
> meaningful digits. How many and how many exactly? For implementing it,
> we can either write a loop of some kind or use more expensive operations
> like ickle is showing me:
>
> http://rafb.net/p/OQ9e7495.html
That technique is not as expensive as it first appears. I've used
log(2)/log(10) for clarity, when in fact it is a compile time constant.
Doing a trivial benchmark of using frexp vs searching a sprintf buffer
(doubling the precision each time we reach the end) suggests that the
frexp method is about 10% slower for 1e-10 (i.e. the frexp call adds
about a 10% overhead) and about 4x quicker for 1e-100 [Intel Core2].
--
Chris Wilson
More information about the cairo
mailing list