POV-Ray : Newsgroups : povray.general : Re: Probably been asked... Why no power operator? : Re: Probably been asked... Why no power operator? Server Time
5 Aug 2024 12:20:19 EDT (-0400)
  Re: Probably been asked... Why no power operator?  
From: Jerry
Date: 14 Nov 2002 17:07:54
Message: <jerry-0B1C72.14075314112002@netplex.aussie.org>
In article <3dd3f208@news.povray.org>, Warp <war### [at] tagpovrayorg> 
wrote:
>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.

Well, not really. You use superscripting to indicate power outside of 
computer languages. The power operator is used because most computer 
languages are typed on terminals that have difficulty accepting 
superscripts. I'd hazard a guess that the 'hat' is used solely because 
it has the effect of 'pointing up', i.e., saying that the next number is 
superscripted.

In my opinion, the power operator should act exactly as superscripting 
does. If

  2
-3

(You will need to be viewing that in a non-proportional font)

is -9, then -3^2 should also be -9; if the above is 9, then -3^2 should 
also be 9.

I'm fairly certain, however, that I remember from algebra that the 
superscripted would result in -9. What is the answer to:

22-3^2

?

I'll note that in the few calculators I have that allow typing in 
freeform, they are split on -3^2:

MoreCalculator:
-3**2
result=-9

bc:
-3^2
9

bwbasic:
bwBASIC: print -3^2
 9

python:
>>> -3**2
-9

perl:
echo print '-3**2, "\n"' | perl
-9

But all of them give 13 as the answer to 22-3^2 :*)

Either solution would be better than throwing out the operator, however.

Jerry
-- 
http://www.hoboes.com/jerry/
"Give a man a fish and you feed him for a day. Teach him to fish, and you've
depleted the lake."--It Isn't Murder If They're Yankees
(http://www.hoboes.com/jerry/Murder/)


Post a reply to this message

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