[SciPy-user] IBM float point format...

Zachary Pincus zachary.pincus@yale....
Wed Jan 14 16:24:42 CST 2009


> python complains that operand >> is not supported on numpy.float32 and
> int (which I understand quite well for float32):
>
>      2     """ Converts an IBM floating point number into IEEE  
> format. """
>      3
> ----> 4     sign = ibm >> 31 & 0x01
>      5
>      6     exponent = ibm >> 24 & 0x7f
>
> TypeError: unsupported operand type(s) for >>: 'numpy.float32' and  
> 'int'
>
> What am I doing wrong ?

I presume you are to read in the data from disk as an int32, which  
then gets processed to a float by Robert's code.

The ufunc operates in the same way -- look at its signature.

Zach


More information about the SciPy-user mailing list