[cairo] _cairo_color_compute_shorts fails with FPU set to single precision

Fabien Costantini fab672000 at yahoo.fr
Thu Aug 31 04:08:37 PDT 2006


>I agree, but wouln't it be better to mult. by 65536 instead of 65536 as follow:
>if (f <= 0) x = 0; else if (f < 1) x = (int)(f*65536); else x = 65535;
>because otherwise even values very near from 1.0 (like 1.0- 1.e-9) would be 65534.
or better :
     if (f <= 0) x = 0; else if (f < 1-epsilon) x = (int)(f*65536); else x = 65535;
 to avoid round approx to 65536 when f is very close to 1, epsilon could still be 1.e-5 

 Fabien


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/cairo/attachments/20060831/7808950b/attachment-0001.html


More information about the cairo mailing list