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:18:17 EDT (-0400)
  Re: Probably been asked... Why no power operator?  
From: Ron Parker
Date: 15 Nov 2002 09:01:39
Message: <slrnat9vi4.2td.ron.parker@fwi.com>
On Thu, 14 Nov 2002 17:18:08 -0500, Greg M. Johnson wrote:
> The problem is that you're more likely to have   4^2-3^2.

That's not unary minus, and is thus exempt from the discussion.

However, unless I'm mistaken about my history, there was another problem 
with the exponentiation operator that was far more "interesting" from 
the coding perspective: exponentiation, by convention, associates right-
to-left, while all other binary operators associate left-to-right.  Thus, 
2^2^3 is 2^8, or 256, rather than 4^3 (64).  Not having an exponentiation 
operator means having a much simpler parser and/or compiler.

Besides, C doesn't have an exponentiation operator, and that's never 
really been a problem.  I mean, why don't we have a "length" operator, 
since it's so much easier to write |A| than vlength(A)?  Why don't we 
have an "angle" operator of some kind, since it's so much easier to 
write a#b or A#B than atan2(a,b) or atan2(vlength(vcross(A,B)),vdot(A,B))
(that's the angle between two vectors A and B.)  For that matter, why 
don't we have C's modulo operator?  What is it about the exponentiation
operator that gets everyone up in arms?

Okay, okay, so it's Pythagoras.  Or, as I like to say, vlength(<a,b,c>),
which is actually shorter than sqrt(a^2+b^2+c^2), and far more likely to
be meaningful to the math-disinclined.  (The 2d version is actually a 
character longer, but nobody uses 2d anymore, right?)

-- 
#local R=<7084844682857967,0787982,826975826580>;#macro L(P)concat(#while(P)chr(
mod(P,100)),#local P=P/100;#end"")#end background{rgb 1}text{ttf L(R.x)L(R.y)0,0
translate<-.8,0,-1>}text{ttf L(R.x)L(R.z)0,0translate<-1.6,-.75,-1>}sphere{z/9e3
4/26/2001finish{reflection 1}}//ron.parker@povray.org My opinions, nobody else's


Post a reply to this message

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