[Numpy-discussion] Products of small float32 values.

2013-10-02 Thread Dave Cook
Can someone explain what is going on here? In [153]: small = ones(1, dtype='float32') In [154]: small Out[154]: array([ 1.], dtype=float32) In [155]: small*1e-45 Out[155]: array([ 1.40129846e-45], dtype=float32) In [156]: small*1e-46 Out[156]: array([ 0.], dtype=float32) I would

Re: [Numpy-discussion] Products of small float32 values.

2013-10-02 Thread Matthew Brett
Hi, On Wed, Oct 2, 2013 at 6:00 PM, Dave Cook dav...@gmail.com wrote: Can someone explain what is going on here? In [153]: small = ones(1, dtype='float32') In [154]: small Out[154]: array([ 1.], dtype=float32) In [155]: small*1e-45 Out[155]: array([ 1.40129846e-45],

Re: [Numpy-discussion] Products of small float32 values.

2013-10-02 Thread Dave Cook
On Wed, Oct 2, 2013 at 6:06 PM, Matthew Brett matthew.br...@gmail.comwrote: Is it possible you are thinking of 2**-126 rather than 10**-126? Yup, brainfart... In [3]: print np.finfo(np.float32) Machine parameters for float32