POV-Ray : Newsgroups : povray.off-topic : Apparently it didn't catch on : Re: Apparently it didn't catch on Server Time
29 Jul 2024 02:21:45 EDT (-0400)
  Re: Apparently it didn't catch on  
From: scott
Date: 25 Feb 2013 10:53:26
Message: <512b88f6$1@news.povray.org>
>> The function definition can use the standard Excel =IF(,,) function
>> to make a conditional result to stop the recursion.
>> The rest would be provided by the standard mechanism of function calls.
>
> I think Andy was talking about how Excel would support recursion, not
> how a user would implement a recusive function.  Currently Excel would
> throw a "Circular reference" error.

...unless you have checked the "Iteration" box under 
Options->Calculation. It's possible to then write a recursive formula, 
the classic example of course is factorial:

Cell A2: =IF(A1="",IF(A2<=1,A2,A2-1),A1+1)
Cell A3: =IF(A1="",A2*A3,1)

You can then type a number in cell A1, hit enter and then delete the 
number (the formula in A2 restarts the iteration when A1 goes empty). 
Cell A3 will then give you the answer.


Post a reply to this message

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