What am I missing:
In [66]: import numpy as np
In [67]: np.float(7.0 / 8)
Out[67]: 0.875 #OK
In [68]: np.float32(7.0 / 8)
Out[68]: 0.875 #OK
In [69]: np.float96(7.0 / 8)
Out[69]: -2.6815615859885194e+154 #WTF
In [70]: sys.version
Out[70]: '2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)]'
Edit. On cygwin the above code works OK:
$ python
Python 2.5.2 (r252:60911, Dec 2 2008, 09:26:14)
[GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.float(7.0 / 8)
0.875
>>> np.float96(7.0 / 8)
0.875
For the completeness, I checked this code in plain python (not Ipython):
C:\temp>python
Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.float(7.0 / 8)
0.875
>>> np.float96(7.0 / 8)
-2.6815615859885194e+154
>>>
EDIT
I saw three bug reports on Numpy's trac site (976, 902, and 884), but this one doesn't seem to be related to string representation. Therefore I have opened a new bug (1263). Will update here the progress