[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Random number generation quirk
From: |
Jordi Gutiérrez Hermoso |
Subject: |
Re: Random number generation quirk |
Date: |
Fri, 28 Feb 2014 17:00:20 -0500 |
On Fri, 2014-02-28 at 15:14 -0500, Michael Pender wrote:
> I have had the problem occur with double rands, but it is much
> easier to reproduce with singles.
Alternatively, we might decide this is not a problem at all and we
just update the docs to say that sometimes rand is exactly 1 (or
exactly 0?).
> That said, it would probably be much faster to do bit manipulations
> place the bits in the appropriate locations. However, I am not sure
> whether assumptions about x86 versus other architectures will
> require specialized coding.
We have dropped the ability to do arithmetic other than IEEE 754 float
arithmetic. We could do bit manipulations instead of casting around
and doing arithmetic. But come to think of it, this might be
complicated. I just remember that we can't use the same exponent bits
for all mantissas, due to the implicit bit.
- Jordi G. H.