POV-Ray : Newsgroups : povray.general : What is wrong with this? : Re: What is wrong with this? Server Time
4 Jul 2024 13:05:28 EDT (-0400)
  Re: What is wrong with this?  
From: Matt Giwer
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

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