[Numpy-discussion] questions about array types

eric hagemann ehagemann at comcast.net
Sun Jan 12 15:14:06 CST 2003


Rereading the numeric docs I see the reference to types Float, Float32, Float64 -- which make sense, however I am curious to understand the usefulness of types Float0, Float8 and Float16 which all seem synonyms for Float32.  Was there some thinking that there would be a converter written for 8bit floats?



>>> from Numeric import *
>>> a = array([1,2,3,4],Float32)
>>> fromstring(a.tostring(),Float32)
array([ 1.,  2.,  3.,  4.],'f')
>>> fromstring(a.tostring(),Float)
array([   2.00000047,  512.00012255])  # corrupt, as would be expected
>>> fromstring(a.tostring(),Float0) #seems to convert back as if Float0 == Float32
array([ 1.,  2.,  3.,  4.],'f')
>>> fromstring(a.tostring(),Float8)
array([ 1.,  2.,  3.,  4.],'f')
>>> fromstring(a.tostring(),Float16)
array([ 1.,  2.,  3.,  4.],'f')
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20030112/c3a64101/attachment-0001.html 


More information about the Numpy-discussion mailing list