[cairo] _cairo_color_compute_shorts fails with FPU set to single precision

Fabien Costantini fab672000 at yahoo.fr
Thu Aug 31 04:41:33 PDT 2006


Carl said:

> >because otherwise even values very near from 1.0 (like 1.0- 1.e-9) would be 65534.
>Yes, 65536 is the correct multiplier.

>> or better :
>  to avoid round approx to 65536 when f is very close to 1

>I greatly prefer the approaches suggested earlier that don't require
>an epsilon value at all and simply touch up any 65536 results that
>come out of the multiplication.



Well epsilon seems useful this time because it will bug otherwise if values are between [1.0-1.e-20,1.0[ 
i.e: the following example:
     int v = (int) ((1.0-1.e-20)*65536);
    printf("val = %d\n",v);

will return 65536 (at least with my intel P4 ).


Fabien
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/cairo/attachments/20060831/e1b8cd20/attachment.htm


More information about the cairo mailing list