|
|
|
|
|
by ralphb
1407 days ago
|
|
This is well-known, and almost trivial.
But because I am curious I looked this up in NR 3rd edition. Section 7.1.5 says > The steps above that convert a 64-bit integer to a double precision floating-point value involves both a non-trivial type conversion and a 64-bit floating multiply. They are performance bottlenecks. One can instead directly move the random bits into the right place in the double word with a union structure, a mask, and some 64-bit logical operations; but in our experience this is not significantly faster It goes on to describe a lagged Fibonacci generator which generates values directly as floating point. |
|