POV-Ray : Newsgroups : povray.beta-test : Function (optimization?) bug : Re: Function (optimization?) bug Server Time
30 Jul 2024 12:28:54 EDT (-0400)
  Re: Function (optimization?) bug  
From:
Date: 9 Jan 2002 06:27:34
Message: <p59o3ugd8582k7t9ucvkhja9jocf9e7dpa@4ax.com>
On Tue, 08 Jan 2002 16:55:36 +0100, "Thorsten Froehlich" <tho### [at] trfde>
wrote:
> 1. ...
> 2. ...
> 3. ...
> optimizations known as "common subexpression eliminations"

Thank You for this explanation.

> > #macro P(F,G)
> > function{
> >   x
> >   #if (F!=0) + #if (F=1) y #else F*y #end #end
> >   + #if (G=0) 1#else #if( G=1) z #else z^G #end #end
> > }
> > #end
>
> You are mistaking functions and macros here.

No. I'm not. I play with functions very nice I think. You can check what is the
problem at http://news.povray.org/rlrb3ukjk8omaba2tfs8bjq8l411s5m7lr%404ax.com

> F and G are declared
> (implicitly) and thus will be substituted by their real value before the
> parser even sees them. Thus they will be constants and all the above
> applies.

That is exactly what I asked: "Should I expect this optimisations for ready
floats or not". Now I have comprehensive answer.

> > Also I wonder if there could be inline type of function
>
> I have been thinking about this, but it sounds much easier than it is.

Perhaps it could be enough to extend macros to passing and returning parts of
functions. For example if below code could be possible

  #macro Test(a,b,c) 4*a+2*c-b #end
  #local F=function{ Test(x,y,z) + Test(z,y,x) }

But it is definitly feature request so do it what you want with it.

I agree with all your other notes and thank You for them.

ABX


Post a reply to this message

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