POV-Ray : Newsgroups : povray.unofficial.patches : Why & has higher precedence than + or - in isosurface functions? Server Time
2 Sep 2024 10:19:02 EDT (-0400)
  Why & has higher precedence than + or - in isosurface functions? (Message 1 to 10 of 41)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Warp
Subject: Why & has higher precedence than + or - in isosurface functions?
Date: 31 Jul 2000 09:03:01
Message: <39857905@news.povray.org>
Is there a reason for the operator & having higher precedence than + or -
in isosurface functions?
  The equivalent operator in logic (the one that looks like an upside down 'V')
hasn't, and it would be natural to have the same precedence in isosurface
functions.
  If I write this function:

function { x+y & y+z }

at least I read it in the same way as in mathematics (I'll use '&' here, but
imagine that it's the upside down 'V'):

x+y=0 & y+z=0

  However the current isosurface implementation reads it this way:

x+(y&y)+z

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Why & has higher precedence than + or - in isosurface functions?
Date: 31 Jul 2000 12:37:30
Message: <3985ab4a$1@news.povray.org>
In article <39857905@news.povray.org> , Warp <war### [at] tagpovrayorg>  wrote:

> Is there a reason for the operator & having higher precedence than + or - in
> isosurface functions?

This looks like a bug to me, it should have lower precedence.


    Thorsten


____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: pk
Subject: Re: Why & has higher precedence than + or - in isosurface functions?
Date: 31 Jul 2000 14:30:43
Message: <3985C626.46C5B6E8@videotron.ca>
Thorsten Froehlich wrote:
> 
> In article <39857905@news.povray.org> , Warp <war### [at] tagpovrayorg>  wrote:
> 
> > Is there a reason for the operator & having higher precedence than + or - in
> > isosurface functions?
> 
> This looks like a bug to me, it should have lower precedence.
is "&" supposed to be the AND logical operator??It seems so,and if it
is, then it's normal: boolean operator have higher precedence than
arithmetical ones in almost all languages(and Maths); if not, then it's
a bug...

Could somebody explain why the patch uses "^" for something else than
exponents??

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

From: Thorsten Froehlich
Subject: Re: Why & has higher precedence than + or - in isosurface functions?
Date: 31 Jul 2000 14:50:47
Message: <3985ca87@news.povray.org>
In article <3985C626.46C5B6E8@videotron.ca> , pk <thi### [at] videotronca>  
wrote:

> Could somebody explain why the patch uses "^" for something else than
> exponents??

As far as I know it does not use it for anything else...


    Thorsten


____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: pk
Subject: Re: Why & has higher precedence than + or - in isosurface functions?
Date: 31 Jul 2000 14:58:30
Message: <3985CCA9.1452D454@videotron.ca>
Thorsten Froehlich wrote:
> 
> In article <3985C626.46C5B6E8@videotron.ca> , pk <thi### [at] videotronca>
> wrote:
> 
> > Could somebody explain why the patch uses "^" for something else than
> > exponents??
> 
> As far as I know it does not use it for anything else...
Then, why did warp say "^"(that's an inverted V, right?) does the
opposite of &?

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

From: Ron Parker
Subject: Re: Why & has higher precedence than + or - in isosurface functions?
Date: 31 Jul 2000 15:20:05
Message: <slrn8obl55.1qn.ron.parker@fwi.com>
On Mon, 31 Jul 2000 14:59:53 -0400, pk wrote:
>Thorsten Froehlich wrote:
>> 
>> In article <3985C626.46C5B6E8@videotron.ca> , pk <thi### [at] videotronca>
>> wrote:
>> 
>> > Could somebody explain why the patch uses "^" for something else than
>> > exponents??
>> 
>> As far as I know it does not use it for anything else...
>Then, why did warp say "^"(that's an inverted V, right?) does the
>opposite of &?

He was referring to the mathematical symbol that looks like an inverted V.
That symbol represents logical "and", and looks nothing like a caret.

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: Peter Popov
Subject: Re: Why & has higher precedence than + or - in isosurface functions?
Date: 31 Jul 2000 15:21:10
Message: <mj1bos4rmn9url4dp0shdmegjdron19h8b@4ax.com>
On 31 Jul 2000 09:03:01 -0400, Warp <war### [at] tagpovrayorg> wrote:

>  Is there a reason for the operator & having higher precedence than + or -
>in isosurface functions?

Well, for me & has always meant binary 'and' or binary multiplication.
As such I find it logical for it to have a higher precedence than
addition. Your mileage may vary but that largely depends on the
programming languages you're most comfortable with :)


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


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Why & has higher precedence than + or - in isosurface functions?
Date: 31 Jul 2000 15:51:58
Message: <3985d8de@news.povray.org>
In article <mj1bos4rmn9url4dp0shdmegjdron19h8b@4ax.com> , Peter Popov 
<pet### [at] usanet>  wrote:

>>  Is there a reason for the operator & having higher precedence than + or -
>>in isosurface functions?
>
> Well, for me & has always meant binary 'and' or binary multiplication.
> As such I find it logical for it to have a higher precedence than
> addition. Your mileage may vary but that largely depends on the
> programming languages you're most comfortable with :)

No, both, binary and logical and should have lower precedence.  If it is
binary it could at most have the same precedence to make any sense at all.
If you look at various programming languages you will find that all current
ones obey the rules set by mathematics.

As for binary operations, I think a dot=and, a plus=or and a line above=not
are very common or even standard.  In this case a 'and' has higher
precedence, but this has little to do with general math and is not related.

The & sign in isosurfaces is obviously the equivalent of the inverted-V, and
thus it should have lower precedence.  As for the not inverted-V, the '|'
(or-sign), I am not sure about the current implementation, but is should
also have lower precedence.


   Thorsten


____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Warp
Subject: Re: Why & has higher precedence than + or - in isosurface functions?
Date: 1 Aug 2000 06:24:26
Message: <3986a55a@news.povray.org>
Thorsten Froehlich <tho### [at] trfde> wrote:
: The & sign in isosurfaces is obviously the equivalent of the inverted-V, and
: thus it should have lower precedence.  As for the not inverted-V, the '|'
: (or-sign), I am not sure about the current implementation, but is should
: also have lower precedence.

  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.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Why & has higher precedence than + or - in isosurface functions?
Date: 1 Aug 2000 07:45:21
Message: <3986b851$1@news.povray.org>
In article <3986a55a@news.povray.org> , 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.

I agree.


____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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