approx_distance: Improve accuracy of 2d and 3d funcs

Fine-tuning the approx-distance 2d function gives accuracy better
than 99.75% in all cases.  Extending this to the 3d version gives
it also accuracy better than 99.5% in all cases.

Code size is reduced by another 240 bytes, but RAM utilization
increased by 32 bytes.