[GRASS5] [bug #3100] (grass) r.proj is making the asymmetric integer truncation error

Morten Hulden morten at untamo.net
Tue Mar 22 07:11:20 EST 2005


> The normal fix is to use floor() as in:
> 
>   int xi;
>   double x;
> 
>   x = <some calculation>
>   xi = (int)floor(x);
> 
> though other solutions may get the same result more efficiently.
> 
> Maciek

Maciek,

in r.proj subroutines nearest.c, bilienear.c and cubic.c there are 
typecasts:

         row = (int)(*row_idx);
         col = (int)(*col_idx);

Can you try to change these as you describe above and recompile your 
r.proj. Then use your test sets again and let us know if it helped or 
not (or got worse :).

Good test sets are needed to track errors like this, and you seem to 
have one.

rgds
Morten




More information about the grass-dev mailing list