POV-Ray : Newsgroups : povray.beta-test : int() and val() don't work in functions : int() and val() don't work in functions Server Time
4 Nov 2024 23:16:09 EST (-0500)
  int() and val() don't work in functions  
From: Mike Williams
Date: 17 Sep 2001 13:16:26
Message: <OsdImCAWCep7Ew$O@econym.demon.co.uk>
"floor()" can be used in simple assignments and in functions

#declare A=floor(B);                    //OK
#declare F=function{floor(x)}           //OK

But int() and val() can be used in simple assignments, but can't be used
inside a function

#declare A=int(B);                      // OK
#declare F=function{int(x)}             // Parse Error

#declare A=val("1.4");                  // OK
#declare F=function{x+val("1.4")}       // Parse Error

The docs, page 6.1.6, say int() and val() are permissible in a function.

Actually, we could live quite happily without val() in functions because
it's not going to change its value during the function evaluation, so we
can simply write
        #declare V=val(My_string);
        #declare function{x+V}
in which case remove "val()" from the list on page 6.1.6.

POV 3.5b2, AMD K6-2 500, 128Mb

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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