POV-Ray : Newsgroups : povray.text.scene-files : power notation change in POV3.6? Server Time
22 Dec 2024 04:28:21 EST (-0500)
  power notation change in POV3.6? (Message 1 to 10 of 12)  
Goto Latest 10 Messages Next 2 Messages >>>
From: Data Banks
Subject: power notation change in POV3.6?
Date: 18 Sep 2006 07:43:39
Message: <450e866b@news.povray.org>
Okay, it's been ages since I tinkered with a file of mine but I fired it up 
today. It'd been started in POV 3.1, then MegaPOV 0.7 and eventually POV3.5, 
without any hassles. But in 3.6 it hits the declare to set the (primative) 
acceleration control for an object's motion and I get a parse error.

#declare accel= (2*clock)^4*20.5;
#declare lift=  (2.0*clock)^(1/5);
#declare Powerup =  ((5.0*clock)^(1/10))/100;

It's moaning when it hits the ^4. Same again at every ^
Okay, so I could probably do it another way but I haven't slept in 2 days & 
I'm not all that good with animation anyway. What am I missing here?


File: G:\working\povray\shuttle.pov  Line: 31
File Context (5 lines):
*/
#declare accel= (2*clock)^
Parse Error: All #declares of float, vector, and color require semi-colon 
';' at end if the language version is set to 3.5 or higher. Either add the 
semi-colon or set the
language version to 3.1 or lower.
Total Scene Processing Times
  Parse Time:    0 hours  0 minutes  0 seconds (0 seconds)
  Photon Time:   0 hours  0 minutes  0 seconds (0 seconds)
  Render Time:   0 hours  0 minutes  1 seconds (1 seconds)
  Total Time:    0 hours  0 minutes  1 seconds (1 seconds)
CPU time used: kernel 0.13 seconds, user 0.06 seconds, total 0.19 seconds

POV-Ray finished


Post a reply to this message

From: Data Banks
Subject: Re: power notation change in POV3.6?
Date: 18 Sep 2006 07:46:08
Message: <450e8700@news.povray.org>
Never mind, think I found it. Change ^ to e, right?



"Data Banks" <da_### [at] ihugcomau> wrote in message 
news:450e866b@news.povray.org...
> Okay, it's been ages since I tinkered with a file of mine but I fired it 
> up today. It'd been started in POV 3.1, then MegaPOV 0.7 and eventually 
> POV3.5, without any hassles. But in 3.6 it hits the declare to set the 
> (primative) acceleration control for an object's motion and I get a parse 
> error.
>
> #declare accel= (2*clock)^4*20.5;
> #declare lift=  (2.0*clock)^(1/5);
> #declare Powerup =  ((5.0*clock)^(1/10))/100;
>
> It's moaning when it hits the ^4. Same again at every ^
> Okay, so I could probably do it another way but I haven't slept in 2 days 
> & I'm not all that good with animation anyway. What am I missing here?
>
>
> File: G:\working\povray\shuttle.pov  Line: 31
> File Context (5 lines):
> */
> #declare accel= (2*clock)^
> Parse Error: All #declares of float, vector, and color require semi-colon 
> ';' at end if the language version is set to 3.5 or higher. Either add the 
> semi-colon or set the
> language version to 3.1 or lower.
> Total Scene Processing Times
>  Parse Time:    0 hours  0 minutes  0 seconds (0 seconds)
>  Photon Time:   0 hours  0 minutes  0 seconds (0 seconds)
>  Render Time:   0 hours  0 minutes  1 seconds (1 seconds)
>  Total Time:    0 hours  0 minutes  1 seconds (1 seconds)
> CPU time used: kernel 0.13 seconds, user 0.06 seconds, total 0.19 seconds
>
> POV-Ray finished
>
>
>


Post a reply to this message

From: Data Banks
Subject: Re: power notation change in POV3.6?
Date: 18 Sep 2006 07:47:57
Message: <450e876d@news.povray.org>
"Data Banks" <da_### [at] ihugcomau> wrote in message 
news:450e8700@news.povray.org...
> Never mind, think I found it. Change ^ to e, right?
>
Well, that didn't work.
Ah,
exp(A) Exponential of A. Returns the value of e raised to the power A where 
e is the base of the natural logarithm, i.e. the non-repeating value 
approximately equal to 2.71828182846.



> "Data Banks" <da_### [at] ihugcomau> wrote in message 
> news:450e866b@news.povray.org...
>> Okay, it's been ages since I tinkered with a file of mine but I fired it 
>> up today. It'd been started in POV 3.1, then MegaPOV 0.7 and eventually 
>> POV3.5, without any hassles. But in 3.6 it hits the declare to set the 
>> (primative) acceleration control for an object's motion and I get a parse 
>> error.
>>
>> #declare accel= (2*clock)^4*20.5;
>> #declare lift=  (2.0*clock)^(1/5);
>> #declare Powerup =  ((5.0*clock)^(1/10))/100;
>>
>> It's moaning when it hits the ^4. Same again at every ^
>> Okay, so I could probably do it another way but I haven't slept in 2 days 
>> & I'm not all that good with animation anyway. What am I missing here?


Post a reply to this message

From: Data Banks
Subject: Re: power notation change in POV3.6?
Date: 18 Sep 2006 07:54:01
Message: <450e88d9@news.povray.org>
Fixed it :)

#declare accel= pow(2*clock,4)*20.5;
#declare lift=  pow(2.0*clock,(1/5));
#declare Powerup =  pow(5.0*clock,(1/10))/100;

Yes yes, I know, my code is messy


"Data Banks" <da_### [at] ihugcomau> wrote in message 
news:450e876d@news.povray.org...
>
> "Data Banks" <da_### [at] ihugcomau> wrote in message 
> news:450e8700@news.povray.org...
>> Never mind, think I found it. Change ^ to e, right?
>>
> Well, that didn't work.
> Ah,
> exp(A) Exponential of A. Returns the value of e raised to the power A 
> where e is the base of the natural logarithm, i.e. the non-repeating value 
> approximately equal to 2.71828182846.
>
>
>
>> "Data Banks" <da_### [at] ihugcomau> wrote in message 
>> news:450e866b@news.povray.org...
>>> Okay, it's been ages since I tinkered with a file of mine but I fired it 
>>> up today. It'd been started in POV 3.1, then MegaPOV 0.7 and eventually 
>>> POV3.5, without any hassles. But in 3.6 it hits the declare to set the 
>>> (primative) acceleration control for an object's motion and I get a 
>>> parse error.
>>>
>>> #declare accel= (2*clock)^4*20.5;
>>> #declare lift=  (2.0*clock)^(1/5);
>>> #declare Powerup =  ((5.0*clock)^(1/10))/100;
>>>
>>> It's moaning when it hits the ^4. Same again at every ^
>>> Okay, so I could probably do it another way but I haven't slept in 2 
>>> days & I'm not all that good with animation anyway. What am I missing 
>>> here?
>
>


Post a reply to this message

From: Mike Williams
Subject: Re: power notation change in POV3.6?
Date: 18 Sep 2006 08:18:10
Message: <vPNYMGAGvoDFFwTD@econym.demon.co.uk>
Wasn't it Data Banks who wrote:
>Fixed it :)
>
>#declare accel= pow(2*clock,4)*20.5;
>#declare lift=  pow(2.0*clock,(1/5));
>#declare Powerup =  pow(5.0*clock,(1/10))/100;

It all seems to have come about due to a rather pedantic disagreement
about the order of precedence of the ^ operator. Rather than just pick a
precedence order and tell anyone who wanted a different order to just
live with it, the ^ operator got ditched.

a*b^c*d might mean different things depending on the order in which the
operators are applied, but with pow() you write a*pow(b^c)*d or
pow(a*b,c*d) and there's no ambiguity.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Trevor G Quayle
Subject: Re: power notation change in POV3.6?
Date: 18 Sep 2006 08:25:00
Message: <web.450e8f0ec43a9bccc150d4c10@news.povray.org>
"Data Banks" <da_### [at] ihugcomau> wrote:
> Fixed it :)
>
> #declare accel= pow(2*clock,4)*20.5;
> #declare lift=  pow(2.0*clock,(1/5));
> #declare Powerup =  pow(5.0*clock,(1/10))/100;
>
> Yes yes, I know, my code is messy

Yes, you've got it now.  This was changed quite awhile ago for reasons that
esacape me at the moment.
-tgq


Post a reply to this message

From: Warp
Subject: Re: power notation change in POV3.6?
Date: 18 Sep 2006 09:12:29
Message: <450e9b3d@news.povray.org>
Mike Williams <nos### [at] econymdemoncouk> wrote:
> a*b^c*d might mean different things depending on the order in which the
> operators are applied

  No, that's not the problem. The exponentiation operator as unambiguously
a higher precedence than the multiplication operator and thus that
expression is (well, should be) evaluated as a*(b^c)*d.

  The problematic cases, however, are these two: -a^2 and a^b^c

  In other words, is the precedence of the exponentiation operator lower
or higher than the precedence of the unary minus in the base? And in the
second case: Should the exponentiation operator be interpreted from
left-to-right (as most other operators) or right-to-left?

  The general consensus globally (ie. outside the POV world) is that
the exponentiation operator should have higher precedence than the
unary minus of the base. In other words, the first expression should
be interpreted as "-(a^2)" and not as "(-a)^2".
  Note that a unary minus in the exponent should, naturally, have a
higher precedence so that expressions like "a^-2" will work.

  As for the second expression, the general consensus seems to be
that the exponentiation operator, unlike most other operators, should
be interpreted from right-to-left. In other words, the second expression
should be interpreted as "a^(b^c)". This is because it more intuitively
represents how exponentiation (ie. superscript) works in mathematics.

  The problem with POV-Ray is that it didn't follow either of these
consensuses and this caused some complaints. The pov-team didn't want
to get into a filosophical discussion about what is the correct way
to interpret the ^ operator so they just removed it and now pow() is
the only official way for exponentiation.

  Note that it's only a question of agreement. It's not a question of
technical difficulties. It is trivial to parse the ^ operator
unambiguously with the precedence rules conforming to the global
consensus (iow. it doesn't even require ugly hacks nor ugly exceptions
in the parsing code, as long as the parsing code is already clean).

-- 
                                                          - Warp


Post a reply to this message

From: Data Banks
Subject: Re: power notation change in POV3.6?
Date: 21 Sep 2006 07:07:41
Message: <4512727d@news.povray.org>
And I'm afraid you've both lost me :(
Once upon a time I'd have been able to follow that discussion, but sadly not 
lately

"Warp" <war### [at] tagpovrayorg> wrote in message 
news:450e9b3d@news.povray.org...
> Mike Williams <nos### [at] econymdemoncouk> wrote:
>> a*b^c*d might mean different things depending on the order in which the
>> operators are applied
>
>  No, that's not the problem. The exponentiation operator as unambiguously
> a higher precedence than the multiplication operator and thus that
> expression is (well, should be) evaluated as a*(b^c)*d.
>
>  The problematic cases, however, are these two: -a^2 and a^b^c
>
>  In other words, is the precedence of the exponentiation operator lower
> or higher than the precedence of the unary minus in the base? And in the
> second case: Should the exponentiation operator be interpreted from
> left-to-right (as most other operators) or right-to-left?
>
>  The general consensus globally (ie. outside the POV world) is that
> the exponentiation operator should have higher precedence than the
> unary minus of the base. In other words, the first expression should
> be interpreted as "-(a^2)" and not as "(-a)^2".
>  Note that a unary minus in the exponent should, naturally, have a
> higher precedence so that expressions like "a^-2" will work.
>
>  As for the second expression, the general consensus seems to be
> that the exponentiation operator, unlike most other operators, should
> be interpreted from right-to-left. In other words, the second expression
> should be interpreted as "a^(b^c)". This is because it more intuitively
> represents how exponentiation (ie. superscript) works in mathematics.
>
>  The problem with POV-Ray is that it didn't follow either of these
> consensuses and this caused some complaints. The pov-team didn't want
> to get into a filosophical discussion about what is the correct way
> to interpret the ^ operator so they just removed it and now pow() is
> the only official way for exponentiation.
>
>  Note that it's only a question of agreement. It's not a question of
> technical difficulties. It is trivial to parse the ^ operator
> unambiguously with the precedence rules conforming to the global
> consensus (iow. it doesn't even require ugly hacks nor ugly exceptions
> in the parsing code, as long as the parsing code is already clean).
>
> -- 
>                                                          - Warp


Post a reply to this message

From: Data Banks
Subject: Re: power notation change in POV3.6?
Date: 21 Sep 2006 07:08:57
Message: <451272c9@news.povray.org>
"Trevor G Quayle" <Tin### [at] hotmailcom> wrote in message 
news:web.450e8f0ec43a9bccc150d4c10@news.povray.org...
> "Data Banks" <da_### [at] ihugcomau> wrote:
>> Fixed it :)
>>
>> #declare accel= pow(2*clock,4)*20.5;
>> #declare lift=  pow(2.0*clock,(1/5));
>> #declare Powerup =  pow(5.0*clock,(1/10))/100;
>>
>> Yes yes, I know, my code is messy
>
> Yes, you've got it now.  This was changed quite awhile ago for reasons 
> that
> esacape me at the moment.
> -tgq
>
I thought I'd post the question, but while I waited I decided I'd re-read 
the manual (catch up on some of the changes since I started learning with 
3.1) and found it. I'll get used to it but I did like the ^ version 
personally


Post a reply to this message

From: Mike Williams
Subject: Re: power notation change in POV3.6?
Date: 21 Sep 2006 08:22:02
Message: <K$dRACAZLoEFFwsu@econym.demon.co.uk>
Come to think of it, it might be possible to consider reintroducing ^
now. 

I think the only reason for considering the non-standard precedence was
to make it easier to port scenes from Megapov 0.* which happened to use
an unusual precedence order. At the time, lots of people were converting
isosurface scenes from MegaPOV 0.* to the POV beta that as experimenting
with ^.

Now that MegaPOV 0.* has been superseded for quite a while by MegaPOV
1.*, which also doesn't have the ^ operator, it could be introduced with
standard precedence without upsetting anyone.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

Goto Latest 10 Messages Next 2 Messages >>>

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