[Numpy-discussion] numpy.random.multinomial() cannot handle zero's

Lino Mastrodomenico l.mastrodomenico@gmail....
Mon Aug 27 19:39:51 CDT 2007


2007/8/28, Stefan van der Walt <stefan@sun.ac.za>:
> I find this behaviour odd for addition.  Under python:
>
> In [7]: 0.8+0.2 > 1.0
> Out[7]: False

Keep in mind that both 0.2 and 0.8 cannot be represented exactly as
floating-point numbers (unless you use decimal floating points, like
the "decimal" module), so the starting point isn't what it appears to
be.

> Sum: 1.00000000000000000000000000000000000000000000000000
> Is greater than 1.0? True

I get True on a x86, gcc-3.3.1, numpy-1.0b5, GNU/Linux box, and False
on x86_64, gcc-4.1.1, numpy-1.0.3.1, GNU/Linux.

YMMV ;-)

-- 
Lino Mastrodomenico
E-mail: l.mastrodomenico@gmail.com


More information about the Numpy-discussion mailing list