From: Harris Reynolds Date: 2006-06-09T09:47:00+09:00 Subject: Re: Converting 8 bytes to a Float --0-988002876-1149814016=:21630 Content-Type: text/plain; charset=us-ascii I am still not getting the results I am looking for hacking around with the couple suggestions I received. Here is an example: bytes = Array.new(8) bytes[0] = 64 bytes[1] = 53 bytes[2] = 0 bytes[3] = 0 bytes[4] = 0 bytes[5] = 0 bytes[6] = 0 bytes[7] = 0 Calling: binary_string = bytes.pack('D') returns a binary string, but not the float which should be 21.0; if I turn around and call binary_string.unpack('d'), I end up with the original bytes. It is turning out that getting from bytes to a Float object is a bit painful. Is there something easy I am missing? thanks, ~harris ----- Original Message ---- From: Timothy Hunter To: ruby-talk ML Sent: Thursday, June 8, 2006 8:26:52 PM Subject: Re: Converting 8 bytes to a Float Harris Reynolds wrote: > What is the quickest way to convert 8 bytes to a Float object? > > thanks for any help, > > ~harris > ri Array#pack flt = arr.pack('D') --0-988002876-1149814016=:21630--