[cairo] Optimize horizontal/vertical gradients
Bill Spitzak
spitzak at d2.com
Fri Feb 18 12:56:30 PST 2005
Keith Packard wrote:
> That's probably a good idea. I suggest we can find an appropriate EPSILON
> by evaluating the extreme values of the two bracketing terms assuming
> the user computed them with the standard C library sin/cos functions using
> the angles -3.0 * M_PI / 2.0, -M_PI/2.0, M_PI/2.0 and 3.0 * M_PI / 2.0.
Calculated using libm.so.6 on RedHat 9.2 machine, printed with %.18g. It
appears that replacing n with -n or with n+1 does not make any
difference to the size of the errors:
n sin(n*pi/2) cos(n*pi/2)
1 +1.000000000000000000 +0.000000000000000061
3 -1.000000000000000000 -0.000000000000000184
7 -1.000000000000000000 -0.000000000000000429
15 -1.000000000000000000 -0.000000000000002695
31 -1.000000000000000000 -0.000000000000003674
63 -1.000000000000000000 +0.000000000000001472
127 -1.000000000000000000 -0.000000000000002447
255 -1.000000000000000000 -0.000000000000010285
511 -1.000000000000000000 -0.000000000000082803
1023 -1.000000000000000000 -0.000000000000000466
2047 -1.000000000000000000 -0.000000000000290540
4095 -1.000000000000000000 -0.000000000000415939
8191 -1.000000000000000000 +0.000000000000242756
16383 -1.000000000000000000 -0.000000000002077832
32767 -1.000000000000000000 +0.000000000000556949
65535 -1.000000000000000000 -0.000000000001449446
131071 -1.000000000000000000 -0.000000000005462236
262143 -1.000000000000000000 -0.000000000013487816
524287 -1.000000000000000000 -0.000000000087746638
1048575 -1.000000000000000000 -0.000000000003433637
2097151 -1.000000000000000000 -0.000000000067638278
4194303 -1.000000000000000000 -0.000000000196047561
8388607 -1.000000000000000000 -0.000000001384188702
16777215 -1.000000000000000000 -0.000000000035180686
33554431 -1.000000000000000000 -0.000000001062454952
67108863 -1.000000000000000000 -0.000000003117003483
More information about the cairo
mailing list