POV-Ray : Newsgroups : povray.general : Re: Probably been asked... Why no power operator? Server Time
5 Aug 2024 14:19:43 EDT (-0400)
  Re: Probably been asked... Why no power operator? (Message 8 to 17 of 37)  
<<< Previous 7 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Slime
Subject: Re: Probably been asked... Why no power operator?
Date: 14 Nov 2002 11:11:40
Message: <3dd3cb3c$1@news.povray.org>
>   It's only consistent that the unary minus has higher precedence than the
> power operator as well, as it allows you to write "-2^3" and "2^-3".
There's
> no mathematical reason for making the unary minus to have a lower
precedence
> then the power operator.


Well, to say there's no mathematical reason doesn't seem entirely correct.
Most everyone is taught that exponentiation comes before negation in an
early algebra class. It's the way we've been taught to think.

I am of the opinion that sacrificing the strange 2^-3 syntax for 2^(-3)
makes more sense than having to use -(3^9) in place of -3^9. This is *sorta*
inconsistent with the way the * operator works, except that no one's going
to argue what the value of -2*2 is.

The thing is, you could say that the multiplication in -2*2 is done first,
and then the unary negation, and it wouldn't matter. So to then say that the
exponentiation is done first in -3^9 makes sense.

Besides, I would think that since we're adding ^ as a new operator, we could
give it whatever precedence we wanted, and it just seems more logical to me
to make it work the way we've been taught it should work than to allow the
2^-3 syntax just for convenience.

If the designers of POV-Ray really think that their implementation makes
more sense, than so be it. I'd rather they hadn't taken it out, even if it
*is* a little strange in certain cases. Besides, by taking it out, they
obviously haven't prevented arguments about it ;)

>   Of course all this hassle would have been avoided if you just had
silently
> used "-(2^3)" without complaining... We would still have the power
operator. ;)

Hah =) I know, sorry. I didn't see it as complaining at the time, though; I
thought it was a bug.

 - Slime
[ http://www.slimeland.com/ ]


Post a reply to this message

From: AC
Subject: Re: Probably been asked... Why no power operator?
Date: 14 Nov 2002 13:13:06
Message: <3dd3e7b2@news.povray.org>
How about a vote? on this subject...
How is it used in real life at an professional level?
I don't think it would hurt to ask a math teachers (Highschool, Collage or
University)
There has to be a way that is a accepted standard.


Here is a way to think about the problem...

5 - 3 = 5 + -3

Just some thoughts


Have a nice day
Ambis

P.S.
My vote would be on -3^2=9


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Probably been asked... Why no power operator?
Date: 14 Nov 2002 13:19:25
Message: <3dd3e92d$1@news.povray.org>
In article <3dd3e7b2@news.povray.org> , "AC" <amb### [at] teliacom> wrote:

> How about a vote? on this subject...

Well, weren't M$ Officefeatures decided by committee votes? ;-)

Really, designing software by committee decision either takes forever or
just fails on all levels of the development process.  Votes a great in
politics but not in software development.

    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: Probably been asked... Why no power operator?
Date: 14 Nov 2002 13:57:12
Message: <3dd3f208@news.povray.org>
AC <amb### [at] teliacom> wrote:
> I don't think it would hurt to ask a math teachers (Highschool, Collage or
> University)

  One problem is that in math there's no power operator, so there is no
operator precedence in the same sense. Only in computer languages there
is a power operator.

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Jellby
Subject: Re: Probably been asked... Why no power operator?
Date: 14 Nov 2002 15:05:26
Message: <3dd40205@news.povray.org>
> I am of the opinion that sacrificing the strange 2^-3 syntax for 2^(-3)
> makes more sense than having to use -(3^9) in place of -3^9. This is
> *sorta* inconsistent with the way the * operator works, except that no
> one's going to argue what the value of -2*2 is.

Wouldn't it be possible to have *both* 3^-2 and -3^2 generate an error, to 
force the use of parenthesis: 3^(-2) and either -(3^2) or (-3)^2? This 
would at least get rid of the need of pow (but not of the need of pov ;) ), 
while givin rise to no misunderstunding.

-- 

Linux User #289967 (counter.li.org)
PGP Pub Key ID: 0x01A95F99 (pgp.escomplinux.org)


Post a reply to this message

From: Warp
Subject: Re: Probably been asked... Why no power operator?
Date: 14 Nov 2002 15:27:41
Message: <3dd4073d@news.povray.org>
Jellby <jel### [at] m-yahoocom> wrote:
> Wouldn't it be possible to have *both* 3^-2 and -3^2 generate an error

  That would be illogical.

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Christopher James Huff
Subject: Re: Probably been asked... Why no power operator?
Date: 14 Nov 2002 15:48:49
Message: <chrishuff-D16DE3.15481814112002@netplex.aussie.org>
In article <3dd33dfe$1@news.povray.org>,
 "Timothy R. Cook" <tim### [at] scifi-fantasycom> wrote:

> Your memory is faulty.  3.1g is the version that came before 3.5.

Not exactly. These were largely bug fix updates of the same version, 
3.1. On the Mac, I think they got up to 3.1g.r2. There may have been a 
3.1h, too, but none of the revisions added a power operator.


> *ducks, runs*

*Throws a handful of ball bearings (mirrored spheres) in Timothy's 
path...*

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Christopher James Huff
Subject: Re: Probably been asked... Why no power operator?
Date: 14 Nov 2002 15:54:37
Message: <chrishuff-B70261.15540814112002@netplex.aussie.org>
In article <3dd3cb3c$1@news.povray.org>, "Slime" <slm### [at] slimelandcom> 
wrote:

> Well, to say there's no mathematical reason doesn't seem entirely correct.
> Most everyone is taught that exponentiation comes before negation in an
> early algebra class. It's the way we've been taught to think.

Um, no. In algebra, there is no precedence, the exponent is in 
superscript, so there is no ambiguity. A plain text programming language 
doesn't have this, an operator has to be used, so it has to pick a 
precedence. I don't know what you were taught...


> Besides, I would think that since we're adding ^ as a new operator, we could
> give it whatever precedence we wanted, and it just seems more logical to me
> to make it work the way we've been taught it should work than to allow the
> 2^-3 syntax just for convenience.

Not for convenience, for self consistency. There isn't an existing rule, 
so the one that was most logical and consistent was chosen.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Probably been asked... Why no power operator?
Date: 14 Nov 2002 16:56:37
Message: <3dd41c15$3@news.povray.org>
How is this off-topic?

"Alan Kong" <ako### [at] povrayWWWSPAMCOMorg> wrote in message
news:5j16tu0p39v97731vch4fp6b24ouvkkpht@4ax.com...
> If a new discussion about this topic begins, kindly set
> followups to povray.off-topic, TIA.
>


Post a reply to this message

From: Timothy R  Cook
Subject: Re: Probably been asked... Why no power operator?
Date: 14 Nov 2002 17:02:29
Message: <3dd41d75@news.povray.org>
Jellby wrote:
> Wouldn't it be possible to have *both* 3^-2 and -3^2 generate an error, to 
> force the use of parenthesis: 3^(-2) and either -(3^2) or (-3)^2? This 
> would at least get rid of the need of pow (but not of the need of pov ;) ), 
> while givin rise to no misunderstunding.

Doesn't 3^(-2) translate to sqrt(3)?

-- 
Tim Cook
http://empyrean.scifi-fantasy.com

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GFA dpu- s: a?-- C++(++++) U P? L E--- W++(+++)>$
N++ o? K- w(+) O? M-(--) V? PS+(+++) PE(--) Y(--)
PGP-(--) t* 5++>+++++ X+ R* tv+ b++(+++) DI
D++(---) G(++) e*>++ h+ !r--- !y--
------END GEEK CODE BLOCK------


Post a reply to this message

<<< Previous 7 Messages Goto Latest 10 Messages Next 10 Messages >>>

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