[cairo] _cairo_color_compute_shorts fails with FPU set to single precision

Carl Worth cworth at cworth.org
Wed Aug 30 09:26:53 PDT 2006

On Wed, 30 Aug 2006 16:22:23 +0000 (GMT), Fabien Costantini wrote:
> De : Behdad Esfahbod <behdad at behdad.org>
> >> i -= ((i >> 16) & 1)
> >That doesn't really help, other than slowing it down.
> well, it just make sure you will substract at max 1,

But it wouldn't help, because if there is an input value f greater than
1.0 then there's no guarantee that the least significant bit of
(int32_t) f * 65536 will be a 1. So even with the addition of the
masking here, incorrect results would still be obtained for some input
values > 1.0.

> but if it is already clamped as you wrote on your previous mail then
> it is not needed.

Yes, the clamping of color channel input values to [0.0, 1.0] exists
and is documented:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060830/dff584ea/attachment.pgp

More information about the cairo mailing list