[cairo] _cairo_color_compute_shorts fails with FPU set to single precision

Bill Spitzak spitzak at d2.com
Thu Aug 31 12:53:02 PDT 2006


Yes I agree, f*65536 is correct.

Fabien Costantini wrote:
> ----- Message d'origine ----
> De : Bill Spitzak <spitzak at d2.com>
> 
>  >Why not put the clamping and conversion into the same code? This would
>  >if (f <= 0) x = 0; else if (f < 1) x = (int)(f*65535); else x = 65535;
> 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.


More information about the cairo mailing list