unsigned long to float.

exarkun at divmod.com exarkun at divmod.com
Mon Sep 20 11:31:45 EDT 2004


On Mon, 20 Sep 2004 10:25:53 -0500, "kingjames" <jf.davis at ngc.com> wrote:
>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?

  http://www.python.org/doc/lib/module-struct.html

  Jp



More information about the Python-list mailing list