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

Re: BYTES to LONG




 I'll try your suggest. However, so far,  floats produced by TOTAL hasn't been
a problem yet with the handful of sample files I have worked on.

 Your right, there is a ENDIAN issue. Especially on the Windows 2000 machine I
am currently working on. I solved this by using IDL's OPENR keyword -
SWAP_ENDIAN.

 Thanks for the tip,

Kelly

Craig Markwardt wrote:

> 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
> --------------------------------------------------------------------------