High-precision computation of optical propagation in inhomogeneous waveguides