|Syntactic Confectionery Delight|
[Study]: Searching for square rootsby monsieur_champs (Curate)
|on Nov 14, 2006 at 13:46 UTC||Need Help??|
monsieur_champs has asked for the
wisdom of the Perl Monks concerning the following question:
I'm training to implement recursive functions based on iteractive processes. For this, I decided to implement a binary search function to finding square roots of numbers without using loops. This is a personal study project, not a school task of any form.
At this moment, I already have a fair good implementation that fit my study needs. I'm not looking for the best solution for the problem of finding square roots. Isaac Newton toke care of this many years ago. ;-) I'm trying to learn better recursive programming techniques.
But I'm facing a funny problem here: I'm not sure how to make the search converge for numbers greather than zero and smaller than 1. Maybe someone here could give me a hand suggesting a method for handling those cases, without using loop keywords.
Thanks in advance for your help. Code follows.