POV-Ray : Newsgroups : povray.general : What is wrong with this? Server Time
2 Jul 2024 10:35:55 EDT (-0400)
  What is wrong with this? (Message 11 to 12 of 12)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Matt Giwer
Subject: Re: What is wrong with this?
Date: 5 Sep 1999 03:19:01
Message: <37D21963.823D374@giwersworld.org>
TonyB wrote:

> Hello. I am having a small math problem. All my life I have found this
> to be true. I even tried it on paper, and it works.

> A/2 + B/2 = (A + B)/2

	Yes. 

> Am I wrong? The reason I ask is because of something that happened to me
> while playing with Jaime Vives' clouds. The line that reads:

> #declare p=sky_color*.5+White*.5;

#declare p=(sky_color*.5)+(White*.5)

> *can* be re-written as:

> #declare p=(sky_color+White)/2;

> right? 

	As I wrote it, yes. 

	I have not tested it but interpretors and compilers and parsers
have their rules of evalution of operators such as * a +. *
should come before + as you assumed. Your first version may be
confusing the POV parser. BUT any well behaved software ALWAYS
obeys parenthesises. When in doubt, use them. 

	They are well behaved becaues their noses get rubbed in it if
they do not obey parenthesises. 

	BTW: Has anyone identified the parser used and where to find the
specs for it?


Post a reply to this message

From: Peter Popov
Subject: Re: What is wrong with this?
Date: 5 Sep 1999 08:46:41
Message: <X2=SN5wz4tdE67BdGUze+A56jDFv@4ax.com>
On Sun, 05 Sep 1999 03:18:59 -0400, Matt Giwer
<mgi### [at] giwersworldorg> wrote:

<snip>
>	BTW: Has anyone identified the parser used and where to find the
>specs for it?

The parser is Chris Young's job, and a good one at that. I find his
code so easy to read and understand, mainly because of the use of
macros like EXPECT etc. And I am not really a programmer, mind you. A
couple of weeks ago I tried to make a parser with YACC for a program I
am writing and liked the ease, but when it came to tweaking the code
it generated, brrrrr! The POV parser OTOH has been designed to allow
for easy modification of existing and addition of new features, at
least this is the way I see it. I hope this answers your question.


Peter Popov
ICQ: 15002700


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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