halley method first version seems correct