<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>> >because otherwise even values very near from 1.0 (like 1.0- 1.e-9) would be 65534.<br>>Yes, 65536 is the correct multiplier.<br><br>>> or better :<br>> to avoid round approx to 65536 when f is very close to 1<br><br>>I greatly prefer the approaches suggested earlier that don't require<br>>an epsilon value at all and simply touch up any 65536 results that<br>>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> int v = (int)
((1.0-1.e-20)*65536);<br> printf("val = %d\n",v);<br><br>will return 65536 (at least with my intel P4 ).<br><br><br>Fabien</div></div></body></html>