[SciPy-user] Convert int 64bits to float

Robert Kern robert.kern@gmail....
Thu Feb 26 13:16:31 CST 2009


On Thu, Feb 26, 2009 at 04:23, Ross Williamson <ross.williamson@usap.gov> wrote:
> Hi everyone
>
> I need to convert a set of bits (64) held in an int64 variable to the
> equivalent (bit) float64.
>
> e.g. number = 5975615269021 - float(number) will not work it will just
> convert it to 5975615269021.00 not whatever it is as a float from the
> raw bits.

In [2]: x = int64(5975615269021)

In [3]: x.view(float64)
Out[3]: 2.9523462171876746e-311

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco


More information about the SciPy-user mailing list