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

2006-10-15 Thread Jón Fairbairn
I wrote: > Vraj Mohan <[EMAIL PROTECTED]> wrote: > > (The equivalent code is well-behaved on MIT Scheme) > > Is it? Is there equivalent code to “my_sqrt :: Float -> > Float”? (that might be pertinent). By which I mean "HINT". (And one of the places to look for bugs is where you have hand coded a

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

2006-10-15 Thread Jón Fairbairn
Vraj Mohan <[EMAIL PROTECTED]> writes: > I am new to Haskell and need help in debugging my code. > > I wrote the following function for calculating square roots using Newton's > method: > > my_sqrt :: Float -> Float > my_sqrt x = improve 1 x > where improve y x = if abs (y * y - x) < e