[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 10 bytes real




Thierry Wannier <thierry.wannier@unifr.ch> writes:

> I want to analyse with IDL data obtained in the lab.
> For this, I have to transfer and read on my PC the data which were
> generated by a "home made" software running on a Mac.
> Transfer: OK
> Read with IDL: ....
> I first fought successfully against a tribe a big-endians integer, then
> found a way to cope with Booleans but now "I feel like a motherless
> child" in front of a bunch of 10 bytes reals (IEEE).
> 
> Some suggestions?
> Thanks: T.Wannier

Ten-byte reals.  Ughh.  Are you sure you can use something normal like
8-byte reals?  IDL doesn't do 10-byte.

For 4- and 8-byte reals I am personally hooked on using IEEE_TO_HOST
and HOST_TO_IEEE from the IDL Astronomy Library.  It has the nifty
benefit converting any standard network-order type, including
integers, into the host-specific endianness. Here is how I use it with
floating point numbers.

bb = bytarr(8)      ;; Read ten bytes of data
readu, unit, bb

ff = double(bb, 0)  ;; Cast to double, but still with the wrong byte order

ieee_to_host, ff    ;; Convert to host byte order

Craig

P.S. You will have to download at least where_negzero.pro
conv_unix_vax.pro as well.

-- 
--------------------------------------------------------------------------
Craig B. Markwardt, Ph.D.         EMAIL:    craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
--------------------------------------------------------------------------