added newton iteration and precision calculation