> > I might have missed it earlier Greg but was the actual problem that this > helps with? I was intrigued by the underlying problem. >
I didn't express myself clearly originally. I was trying to convert a 64-bit random integer into a double and guarantee that all possible 2^53 floating values in the range 0 to 1 could result. Someone suggested that weird bit of earlier incomprehensible code, but it turns out a simple shift-and-multiply does that trick. There are lots of modern PRNGs that generate 64-bits, like the xoroshift** that is being used in the latest Random class. But how do you convert 64-bits "perfectly" into doubles? I finally confirmed a correct way. I'm still wondering if there is a way of manually constructing an IEEE 754 number from the raw bits, but it makes my head hurt. Cheers, *GK*