I see the benefit of not relying on the binary representation. But still, this hash only really makes sense for doubles. And then, simply using the first 32 bits would achieve something similar, i.e. hashing close numbers to the same value in less cycles.
Why is hashing close numbers to the same value a benefit? Especially for hash tables I think it would be good to avoid situations where collisions can be produced systematically easily.
On Fri, 18 Mar 2011, Mirar @ Pike developers forum wrote:
I think I would still say something like
q = 2000000000 + round(log(f)*1000000);
which has the benefit of being portable and that numbers that are close to each other will hash to the same values.
Special cases is needed for inf and nan, though.