[Numpy-discussion] Products of small float32 values.

Dave Cook daverz at gmail.com
Wed Oct 2 21:00:06 EDT 2013


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 expect float32 to be able to represent
numbers with exponents as small as -127.

Thanks,
Dave Cook
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20131002/1d2b3841/attachment.html>


More information about the NumPy-Discussion mailing list