The other method described looks to me like its for float textures, I'm not certain. The article is not very well written.

Now, since I've got my cubemap code working and my pipeline ready to start rendering depthmaps, I went and implemented the encode/decode in C++ just for giggles to see what kind of precision loss there is, and I nearly died. It's absurd.

It looks to me like you have your multiplications and your divisions reversed. I'd have expected to see Out.a = SquaredDistance / 2^24, ShadowSample.a * 16777216, etc. I can't make any sense of doing it the other way around.

As a future exercise, I'll point out another path you can play around with:

On a renderer that exports ARB_texture_float and ARB_texture_rg, you ought to be able to create an R32F cubemap, and render directly to it. That way you can just write out floats directly and skip the pack/unpack.

However as of 10.6.2, the Radeon X1600 supports sampling from this format but not rendering to it. Hopefully that will be rectified in a future update.