[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: BYTES to LONG
Kelly Dean <krdean@lamar.colostate.edu> writes:
> Thanks Paul,
>
> Your suggestion solved my problem.
>
> long_x = TOTAL( ISHFT( LONG(x), [24,16,8,0] ) )
Hi Kelly--
While this may seem to work, I agree with JD that this is a bit
dangerous since it converts to floating point. The expression
long_x = long(x, 0, 1)
should produce the same, and correct, result, without invoking any
floating point conversions. However you may have to worry about
so-called "endian" issues, that is byte ordering differences between
machines. A routine in the IDL Astronomy Library like IEEE_TO_HOST
should be able to help you there.
Craig
--
--------------------------------------------------------------------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
--------------------------------------------------------------------------