G. Allegri wrote:

> > This isn't about the if() function. The bitand() function (to which
> > the error message refers) corresponds to the bitwise-and operator "&".
> >
> > The if() function accepts either integer or floating-point values for
> > its arguments.
> 
> That's what disappointed my client (and me) Glynn: why integer yes and not
> floats? Is it a technical limitation or there's a ratio behind it?
> Anyway did I miss something from the docs? I couldn't find it.

What would you expect the value of (x & y) to be if x and/or y were
floating-point values?

> Why do you that I'm confusing the operators? I've always talked about
> logical operators...

Because you quote an error message which specifically refers to a
*bitwise* operator:

> "Incorrect argument types to function bitand()".

in a message which otherwise only mentions logical operators.

"bitand()" is the name of the bitwise-and function, which corresponds to
the infix "&" operator. I.e. (x & y) is exactly equivalent to bitand(x, y).

This is the same as the "&" operator in C or C++: it evaluates to an
integer where each bit in the result is set (one) if the corresponding
bit is set in both operands, and unset (zero) otherwise. E.g. (23 & 34)
is
          00010111 (23)
        & 00100010 (34)
          --------
        = 00000010 ( 2)

Perhaps it would help if you posted the exact expression which is
causing you problems.

-- 
Glynn Clements <gl...@gclements.plus.com>
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to