<html><head><style type="text/css"><!-- DIV {margin:0px} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">Carl said:<br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div>&gt; &gt;because otherwise even values very near from 1.0 (like 1.0- 1.e-9) would be 65534.<br>&gt;Yes, 65536 is the correct multiplier.<br><br>&gt;&gt; or better :<br>&gt;&nbsp;&nbsp;to avoid round approx to 65536 when f is very close to 1<br><br>&gt;I greatly prefer the approaches suggested earlier that don't require<br>&gt;an epsilon value at all and simply touch up any 65536 results that<br>&gt;come out of the multiplication.<br></div></div><br>Well epsilon seems useful this time because it will bug otherwise if values are between [1.0-1.e-20,1.0[ <br>i.e: the following example:<br> &nbsp;&nbsp;&nbsp; int v = (int)
 ((1.0-1.e-20)*65536);<br>&nbsp;&nbsp;&nbsp; printf("val = %d\n",v);<br><br>will return 65536 (at least with my intel P4 ).<br><br><br>Fabien</div></div></body></html>