[Numpy-discussion] numpy.random.multinomial() cannot handle zero's
Stefan van der Walt
stefan at sun.ac.za
Mon Aug 27 19:29:56 EDT 2007
On Mon, Aug 27, 2007 at 11:07:00AM -0700, Christopher Barker wrote:
> Is the kahan_sum closer? -- it should be, though compensated summation
> is really for adding LOTS of numbers, for 4, it's pointless at best.
> Anyway, binary floating point has its errors, and compensated summation
> can help, but it's still not exact for numbers that can't be exactly
> represented by binary.
> i.e. if your result is within 15 decimal digits of the exact result,
> that's as good as it gets.
I find this behaviour odd for addition. Under python:
In : 0.8+0.2 > 1.0
but using the Pyrex module, it yields true. You can find the code at
and compile it using
pyrexc sum.pyx ; python setup.py build_ext -i
When you run the test, it illustrates the problem:
Is greater than 1.0? True
More information about the NumPy-Discussion