|
 |
Warp wrote:
>
> Peter Popov <pet### [at] usa net> wrote:
> : I don't know why, it's just that when I see logic operators I think
> : it's reasonable for them to expect boolean operands (promoted to
> : boolean if needed). And with that in mind, I expect multiplication to
> : have a higher precedence than addition, regardless of context.
>
> & and | are not boolean operators. The are set theory operators.
>
> When you write: function { x & y }
> you are actually saying:
>
> x<0 AND y<0
>
> not something like:
>
> (x LOGICAL_AND y) < 0
>
> which makes little sense.
>
> What is (0.5 LOGICAL_AND -2.8)?
You've never made any programmation before, have you?
In most programming languages, they assign a value to TRUE, and another
to FALSE(in the case above, FALSE=0, and TRUE=NOT(FALSE) )
In other languages, fe, C(for which i dont't really remember the
standard), it's something like TRUE = -1 (binary 11111111) and FALSE
would be 0(binary 00000000)...
And, for your trivia, it depends: most languages will do logical
operations bit by bit, but i suppose that others have a Boolean
type(Java, fe i think), and will undercast it before doing the
LOGICAL_AND
And, yes, doing Logical operations bit by bit can be useful, and anyway,
you can just add a comparison operator before doing the boolean
operation...
HTH,
Paul
--
AKA paul_virak_khuong at yahoo.com, pkhuong at deja.com, pkhuong at
crosswinds.net and pkhuong at technologist.com(list not complete)...
Post a reply to this message
|
 |