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:15:29 EDT (-0400)
  Re: Why & has higher precedence than + or - in isosurface functions?  
From: Peter Popov
Date: 1 Aug 2000 15:54:04
Message: <h24eosk8rdph7u255d2ckk55gckclf374v@4ax.com>
On 1 Aug 2000 06:24:26 -0400, Warp <war### [at] tagpovrayorg> wrote:

>  Also | should have lower precedence than &, so if we have this:
>
>x-y | y-z & x+z
>
>it should be interpreted in this way:
>
>(x-y) | ((y-z) & (x+z))
>
>  In this way it will be consistent with mathematics.

Call me stupid but I've never interpreted it this way. Instead, I'd
have read it thus:

x - ( (y?1:0) | (y?1:0) ) & (x?1:0)) + z

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.


Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] usanet
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

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