[sane-devel] Epson driver - rounding problems
Mon, 25 Aug 2003 10:29:42 +0200
On Mon, Aug 25, 2003 at 09:18:29AM +0200, Guy Brooker wrote:
> In a similar vein, is there not also a rounding problem in the definition of
> #define SANE_FIX(v) ((SANE_Word) ((v) * (1 << SANE_FIXED_SCALE_SHIFT)))
> Should this not be ?
> #define SANE_FIX(v) ((SANE_Word) (0.5 + (v)
> * (1 << SANE_FIXED_SCALE_SHIFT)))
SANE_FIX() is defined in the SANE standard as:
"Returns the largest SANE fixed-point value that is smaller than the
double value d."
So I think the current implementation is correct.