[sane-devel] Epson driver - rounding problems

Henning Meier-Geinitz henning at meier-geinitz.de
Mon Aug 25 09:29:42 BST 2003


Hi,

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
> SANE_FIX()
> 
> #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.

Bye,
  Henning



More information about the sane-devel mailing list