line-for-line port of pix2ang_ring.pro from the official HEALPix library