Accurate pressure gradient calculations in hydrostatic atmospheric models