The results of random are not bit-identical between the Python interpreter
and compiled code. Only the lowest order bits are affected - the
difference is not visible with the default floating point output precision.
In lib/random.cpp, line 205
return (((a*67108864.0)+b)*(1.0/9.00719925474e+15));
This line should be (see Python 2.5.1 source, _randommodule.c)
return (((a*67108864.0)+b)*(1.0/9007199254740992.0));
The following program will demonstrate the issue (need to hack the
generated cpp to see the full precision).
import random
random.seed(123)
r = random.uniform(-1.0,1.0)
#print "%20.16"%r
print repr(r)
Original issue reported on code.google.com by markdew...@gmail.com on 28 Jan 2008 at 3:50
Original issue reported on code.google.com by
markdew...@gmail.com
on 28 Jan 2008 at 3:50