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

Home » Public Forums » archive » more bugs in envi !!!
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: more bugs in envi !!! [message #35817 is a reply to message #35725] Sun, 13 July 2003 06:29 Go to previous messageGo to previous message
marc schellens[1] is currently offline  marc schellens[1]
Messages: 183
Registered: January 2000
Senior Member
> Hi folks!
> Sorry to trouble u again....but envi seems to be just going above my
> head...there is another problem that i am facing:
> Please go through the 2 functions:
>
> 1.function example,b1
> help,b1
> end
> 2.function example,b1,b2
> help,b1
> end
>
> Now could anyone tell me why these 2 codes are producing different
> final answers??? I just cant find any reason for it.
>
> One more problem :
>
> 'b1' is a positive array and 'avgb1' is a positive number but when i
> use the formula : result=b1*100/avgb1
> print, result
> , the answer that i get is a negative array.
>
> Whereas if i use the formula : result=b1/avgb1
> print, result * 100
> , then i get a positive array
>

Even without knowing ENVI, the second problem isn't a bug in ENVI.

A integer occupies (in IDL) 16-bit, and therfore covers a range form
-32768 to
32767

anything larger (or smaller) cannot be represented and therefore you
observe an 'overflow', resulting in a negative number.
IDL evalutates your expressinon from left to right, the
overflow occurs after the multiplication with 100.
In the second case the division is done first and thus the value seems
to be small enough not to overflow in the later multiplication.

The solution is to convert your b1 array to LONG.
But did you notice that you do an integer division?
1/2 equals 0.
Maybe you want to use FLOAT or DOUBLE.

hdh,
marc
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Making a 2D Array from 3 columns
Next Topic: Re: IDL 6.0 is released!

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

Current Time: Wed Oct 08 15:26:35 PDT 2025

Total time taken to generate the page: 0.00426 seconds