"Komag" wrote:
Well, don't int and fix take in a float, not a double float, so the extra precision is wasted?
Yes - the second time it was int() and fix() to be blamed - because of them taking a Float argument, when feeding them a Double it will get down-cast to whatever a Float can hold. And a Float has only 24 bits for the mantissa/significant (to store significant digits). Now 24 bits is
exactly how many we needed after the 8-bit shift right - but the conversion Double->Float has also rounded up the number (which generally is the right thing to do), so the precision is 1 bit less (or is it 0.5 bit?), which here was enough to screw up the result
A possible fix for int/fix functions is to make them take Double argument. Or an unspecified type argument and then choose what to do internally.