unsigned long to float.

Larry Bates lbates at swamisoft.com
Mon Sep 20 11:42:34 EDT 2004


Use struct.unpack to convert into a float.

Larry Bates

"kingjames" <jf.davis at ngc.com> wrote in message 
news:cimsoo$e6b$1 at gateway.northropgrumman.com...
>I have a c30 to ieee float converter algorithm that takes binary data from 
>a
> c30, does some bit munipulation and stores the answer (i'm using unsigned
> longs for the processing).  When I come up with the answer, if I was in C 
> or
> Fortran, I could use either a union or equivalence to see the number in
> floating point rather than the representation in unsigned long.  I have
> found no equivalence in python of union or equvalence.  I could take the
> unsigned long, write it to a binary file and read it back in as a float.
> This would work, accept I do not want the overhead of io.  What can I do 
> to
> see this unsigned long as a float?
>
> Thanks
>
> 





More information about the Python-list mailing list