[Haskell-cafe] Debugging Newton's method for square roots

Clifford Beshers clifford.beshers at linspire.com
Sun Oct 15 14:50:17 EDT 2006


Vraj Mohan wrote:
> This works for several examples that I tried out but goes into an infinite loop
> for my_sqrt 96. How do I go about debugging this code in GHC or Hugs?
>
> (The equivalent code is well-behaved on MIT Scheme)
>   

There was some excellent advice in the other responses, but I thought it 
worth mentioning that your Haskell code converges if you step up from 
Float -> Float to Double -> Double.



More information about the Haskell-Cafe mailing list