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 3 of 4 Topic 5649 of 5741
Post > Topic >>

Re: understanding 'fix' command!

by vino <astrocrazy@[EMAIL PROTECTED] > Apr 18, 2008 at 12:07 PM

On 18 Apr, 17:32, F=D6LDY Lajos <fo...@[EMAIL PROTECTED]
> wrote:
> 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=3D[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 <=3D int <=3D 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 =3D 39322 =3D 65536-26214 =3D -26214)
>
> > IDL> print,fix(c,1)
> >  -26215
>
> reads memory as int from offset 1: the two bytes 153, 153 give -26215
> (153+256*153 =3D 39321 =3D 65536-26215 =3D -26215)
>
> > IDL> print,fix(c,2)
> >   16281
>
> reads memory as int from offset 2: the two bytes 153, 63 give 16281
> (153+256*63 =3D 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

Hi Lajos,
Thank you very much for explaining me. I didnt know how floating point
numbers are represented in binary.
I understand it very well now. thank you very much,#
regards,
vino




 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 3:20:22 CDT 2008.