Fixing square root function

I don't have Scala on now, so it can not work. But previous versions
were definitely wrong.
Method explained in http://www.johannes-bauer.com/compsci/ecc/ chapter
named "Square Root"