POV-Ray : Newsgroups : povray.general : Re: Probably been asked... Why no power operator? Server Time
5 Aug 2024 14:18:59 EDT (-0400)
  Re: Probably been asked... Why no power operator? (Message 1 to 10 of 37)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Peter Popov
Subject: Re: Probably been asked... Why no power operator?
Date: 13 Nov 2002 21:22:18
Message: <u226tughik82ggvv847sgr277j3pdicsdb@4ax.com>
>Is there a reason it's gone?

It's definitely been asked before and yes, there is a reason. There
was a Team decision to remove it altogether because the user community
could not agree how they wanted it implemented in terms of precedence
(more precisely, with regard to the unary minus operator)


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


Post a reply to this message

From: Alan Kong
Subject: Re: Probably been asked... Why no power operator?
Date: 13 Nov 2002 21:25:55
Message: <5j16tu0p39v97731vch4fp6b24ouvkkpht@4ax.com>
On Wed, 13 Nov 2002 20:10:26 EST gilroy wrote:

>I was wondering why the "raise to a power" operator was removed from
>POV-Ray.  (IIRC it was in earlier versions, though perhaps not 3.1.)

  As Peter has stated, the 'hat' operator was implemented during the
beta-testing period in 3.5, but was dropped, IIRC, due to extensive
discussions (arguments) about operator precedence without reaching a
definitive conclusion.

  If a new discussion about this topic begins, kindly set followups to
povray.off-topic, TIA. If a consensus is reached in that group, I will
be aware of it ;)

-- 
Alan
ako### [at] povrayorg
a k o n g <at> p o v r a y <dot> o r g


Post a reply to this message

From: Mike Williams
Subject: Re: Probably been asked... Why no power operator?
Date: 13 Nov 2002 21:34:19
Message: <Qr$j1CAksw09EwtL@econym.demon.co.uk>
Wasn't it gilroy who wrote:
>I was wondering why the "raise to a power" operator was removed from
>POV-Ray.  (IIRC it was in earlier versions, though perhaps not 3.1.)

It was only ever in patched versions (e.g. MegaPov) and some 3.5 beta
versions. There was a little bit of disagreement on the beta groups
about operator precedence which somehow failed to be resolved
successfully, and ended up with the operator being pulled. With the
"pow" function the precedence problem doesn't arise.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Christopher James Huff
Subject: Re: Probably been asked... Why no power operator?
Date: 13 Nov 2002 21:37:05
Message: <chrishuff-655094.21363213112002@netplex.aussie.org>
In article <web.3dd2f802cd39b0a38042f4fa0@news.povray.org>,
 "gilroy" <nomail@nomail> wrote:

> I was wondering why the "raise to a power" operator was removed from
> POV-Ray.  (IIRC it was in earlier versions, though perhaps not 3.1.) 

Your memory is faulty, it was never added. 3.1 is the version that came 
before 3.5, nothing in between, and neither supported it. You are 
probably thinking of MegaPOV.


> With ever more functioning becoming common in POV-Ray, the lack of a simple
> power notation seems, to me, to be a real step backward in readability.  Is
> there a reason it's gone?

Basically, somebody made a big stink about the precedence not being what 
they wanted it to be, and it got pulled before 3.5 was publicly released.

-- 
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: Slime
Subject: Re: Probably been asked... Why no power operator?
Date: 14 Nov 2002 00:45:06
Message: <3dd33862$1@news.povray.org>
> Basically, somebody made a big stink about the precedence not being what
> they wanted it to be, and it got pulled before 3.5 was publicly released.


That was me! =)

But I merely brought it up. I was only pointing it out as a problem (it
seemed like an obvious bug to me, it didn't occur to me that it might have
been thought out; i mean, of *course* -3^2 is -9!) Then I guess that started
an argument, and in the next beta version, it was gone.

Sorry =)

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


Post a reply to this message

From: Timothy R  Cook
Subject: Re: Probably been asked... Why no power operator?
Date: 14 Nov 2002 01:09:02
Message: <3dd33dfe$1@news.povray.org>
Christopher James Huff wrote:
> Your memory is faulty, it was never added. 3.1 is the version that came 
> before 3.5, nothing in between, and neither supported it.

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

*ducks, runs*

-- 
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

From: Warp
Subject: Re: Probably been asked... Why no power operator?
Date: 14 Nov 2002 03:46:31
Message: <3dd362e6@news.povray.org>
Slime <slm### [at] slimelandcom> wrote:
> i mean, of *course* -3^2 is -9!

  The factorial of 9? I don't think so. ;)

  But seriously. The problem is with precedence.
  In order to understand the problem, let's think about another operator
and relate it to the unary minus: the multiplication operator.
  Since the unary minus has higher precedence than the multiplication
operator, you can write things like "-2*3" or "3*-2" and they both mean
the same thing (of course multiplication is a bit problematic as an example
because the result of "-2*3" will be the same regardless of the precedence
of the operators).
  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.
  What you would have wanted is to make the unary minus to have a lower
precedence. This would make "2^-3" illegal because a higher-precedence
operator needs to be evaluated before the lower-precedence one and in
this case it can't be done.
  Of course you will probably answer that in this case the unary minus should
be evaluated first and then the power operator. This contradicts the order
of evaluation of "-2^3" where you want them to be evaluated the other way
around.

  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. ;)

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

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

Goto Latest 10 Messages Next 10 Messages >>>

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