c++ rootfinder almost done