comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Float procedure
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Float procedure [message #13742] Wed, 02 December 1998 00:00 Go to previous message
eddie haskell is currently offline  eddie haskell
Messages: 29
Registered: September 1998
Junior Member
Charlie Solomon wrote:
>
> Can anyone shed some light on how this byte array is converted into a
> floating point number?
> two_words = bytarr(4)
> two_words = [244, 232, 165, 64]

first off, the second assignment statement makes two_words an intarr,
not a bytarr as intended.
to keep two_words as a bytarr do something like:
two_words = byte([244,232,165,64]) -or maybe-
two_words[*] = [244, 232, 165, 64]

> IDL> print, float(two_words, 0)
> 2.13062e-038

when you use the offset in the float procedure, IDL takes the first 32
bits it finds from the point
specified in the offset, in this case, the beginning of the array.

you can see this if you look at the binary representation of the numbers
(i.e. using kevin ivory's
binary program):

IDL> print,binary(float(two_words,0))
0 0 0 0 0 0 0 0 1 1 1 1 0 1 0 0
0 0 0 0 0 0 0 0 1 1 1 0 1 0 0 0
IDL> print,binary(244),binary(232)
0 0 0 0 0 0 0 0 1 1 1 1 0 1 0 0
0 0 0 0 0 0 0 0 1 1 1 0 1 0 0 0

as to the difference between machines, that could be a big/little endian
thing but i really don't
know for sure (can anybody verify this?)

cheers,
eddie

----- ---- --- ---- --- --- --- --- -- -- -- - - - -
|\ A. G. Edward Haskell
|\ Center for Coastal Physical Oceanography
|\ Old Dominion University, Norfolk VA 23529
|\ Voice 757.683.4816 Fax 757.683.5550
|\ e-mail haskell@ccpo.odu.edu
----- ---- --- ---- --- --- --- --- -- -- -- - - - -
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: ENVI ROI public code??
Next Topic: Re: 3D convolution

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 05:14:17 PDT 2025

Total time taken to generate the page: 0.00500 seconds