[cairo] Different output between Linux and Mac

Jeff Muizelaar jeff at infidigm.net
Wed Mar 18 18:27:34 PDT 2009


On Wed, Mar 18, 2009 at 05:48:05PM -0600, Neil Mayhew wrote:
> >... so I'm sending some files. Attached are the SVGs from Mac and 
> >Linux. There's just two very slight differences, which aren't easily 
> >to spot in a regular line-oriented diff. You need to look at them in 
> >meld (Linux) or TextWrangler's diff (Mac) to see the difference. For 
> >example, on line 9 Mac has 0.834007 and Linux has 0.834694.
> >
> >I'm also sending the output of cairo-trace --no-callbacks. I couldn't 
> >build it on Mac (you knew this, right?) , because it depends on ELF 
> >for the callbacks. However, I built it on Linux from git, and ran it 
> >with the system cairo libraries. Based on my own tracing, I believe 
> >the output on Mac would be identical if it were possible.
> >
> >Interestingly, some of the coordinates in the SVGs don't agree with 
> >what's in the trace. In the first stroked path, for example, the SVG 
> >has "M 0 0.000341478" but the trace has "0 0 m" (which corresponds to 
> >what I had in my code). However, the 87.971302 that follows almost 
> >immediately agrees exactly. Then there's a disagreement over 75.779717 
> >vs 75.779804, but agreement on -12.971302. It looks like there's some 
> >sort of rounding error going on, but not in every case.
> >
> >I know these differences may seem very small, but they make regression 
> >testing almost impossible.
> >

I'm guessing these differences are due snprinf implementation
differences or perhaps floating point rounding mode?

One option here would be to replace the use of snprintf with a builtin
version perhaps using http://www.netlib.org/fp/dtoa.c?

-Jeff


More information about the cairo mailing list