[cairo] rewriting libpixman

Jeff Muizelaar jeff at infidigm.net
Mon Apr 2 12:47:56 PDT 2007


On Mon, Apr 02, 2007 at 12:30:48PM -0400, James Cloos wrote:
> And of course, do remember that .99999... == 1.0, and that that works
> for the largest digit of any base.  So the sample specified by all 1
> bits is, if you treat samples as the first approximations of infinite
> series, the same as 2^n, given an n-bit sample.

I still don't follow this logic, specifically the last sentence.

> So, given a 5 bit sample, were you to cast it to an int32_t or float,
> multiply it by 256 and then divide by 31 you get (with the right
> rounding, of course) the same as doing the bit shifts.

Why should we prefer:

28*256/31 = 231.225806451

instead of

28*255/31 = 230.322580645

when:

28/31 = .903225806
and
231/255 = .905882352
230/255 = .901960784

-Jeff


More information about the cairo mailing list