fixed sqrt function for calc