Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Idl-pvware > Re: understandi...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 4 Topic 5649 of 5741
Post > Topic >>

Re: understanding 'fix' command!

by =?ISO-8859-2?Q?F=D6LDY_Lajos?= <foldy@[EMAIL PROTECTED] > Apr 18, 2008 at 06:32 PM

On Fri, 18 Apr 2008, vino wrote:

> Hi!
> I was trying out the 'FIX' command and i couldnt understand all the
> arguments present. Can someone help me please? below is whats i did!
> IDL> c=[1.2,-3.4,5.]
> IDL> print,fix(c)
>       1      -3       5

You have converted a float array to int.

FIX converts to IDL int, which is 16 bits wide, is signed and its range is

-32768 <= int <= 32767. I assume you know how numbers are represented in 
computers. (The following is valid on little-endian machines only.)

Your float array occupies 12 bytes in memory, namely:

154 153 153 63 154 153 89 192 0 0 160 64 (in decimal)


> IDL> print,fix(c,0)
>  -26214

reads memory as int from offset 0: the two bytes 154, 153 give -26214
(154+256*153 = 39322 = 65536-26214 = -26214)

> IDL> print,fix(c,1)
>  -26215

reads memory as int from offset 1: the two bytes 153, 153 give -26215
(153+256*153 = 39321 = 65536-26215 = -26215)

> IDL> print,fix(c,2)
>   16281

reads memory as int from offset 2: the two bytes 153, 63 give 16281
(153+256*63 = 16281)

> IDL> print,fix(c,0,1)
>  -26214

same as first, reads 1 int (from offset 0)

> IDL> print,fix(c,0,2)
>  -26214   16281
>

same as first and third, reads 2 ints (from offset 0 and 2)

regards,
lajos




 4 Posts in Topic:
understanding 'fix' command!
vino <astrocrazy@[EMAI  2008-04-18 08:24:36 
Re: understanding 'fix' command!
=?ISO-8859-2?Q?F=D6LDY_La  2008-04-18 18:32:08 
Re: understanding 'fix' command!
vino <astrocrazy@[EMAI  2008-04-18 12:07:07 
Re: understanding 'fix' command!
vino <astrocrazy@[EMAI  2008-04-18 12:16:52 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat May 17 6:31:19 CDT 2008.