POV-Ray : Newsgroups : povray.unofficial.patches : Why & has higher precedence than + or - in isosurface functions? : Re: Why & has higher precedence than + or - in isosurface functions? Server Time
2 Sep 2024 06:19:37 EDT (-0400)
  Re: Why & has higher precedence than + or - in isosurface functions?  
From: pk
Date: 2 Aug 2000 10:24:36
Message: <39882F7E.6A2B29FE@videotron.ca>
Warp wrote:
> 
> Peter Popov <pet### [at] usanet> 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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.