I wonder if anyone is familiar with z-order, described here:

Z-order (curve) - Wikipedia, the free encyclopedia

Now, this algorithm works like a charm for integer values, but for doubles, simple bit-interleaving fails. Can someone explain why? Does anybody know if this has been done with double values?

Assuming that it can't be done for floating points directly, is there a way to map between integers and floating points such that the bit interleaving will work?

My problem is the range - I am sorting things from 0 to several thousand, with every order of magnitude in between, so any simple mapping that I can see would require an extremely fine grid, which is really not desireable.