On the solution of the dispersion relation for water waves