[Numpy-discussion] Errors with "**" for numpy.float16

Edward C. Jones edcjones at comcast.net
Sun Jun 10 20:21:29 EDT 2012


#! /usr/bin/env python3.2

import numpy

for t in (numpy.float16, numpy.float32, numpy.float64, numpy.float128):
     two = t(2)
     print(t, two, two ** two, numpy.power(two, two))

"""
I use up-to-date debian testing (wheezy), amd64 architecture.  The python
package is python3, version 3.2.3~rc1-2.  The numpy package is 
python3-numpy,
version 1:1.6.2~rc1-1.

"**" has problems for float16:

<class 'numpy.float16'> 2.0 1.1921e-07 4.0
<class 'numpy.float32'> 2.0 4.0 4.0
<class 'numpy.float64'> 2.0 4.0 4.0
<class 'numpy.float128'> 2.0 4.0 4.0
"""




More information about the NumPy-Discussion mailing list