Re: Simple overflow error [message #33770] |
Wed, 29 January 2003 09:33 |
Pavel A. Romashkin
Messages: 531 Registered: November 2000
|
Senior Member |
|
|
I get a feeling you don't really care what the data type is in this case.
Try
a = 200. * 200
Cheers,
Pavel
New2IDL wrote:
>
> HI,
> I have a small problem with overflow.
>
> a = 200 * 200
> print, a
>
> I get the answer as a negative no. can anybody please tell me how to fix this.
>
> Thanks
|
|
|
Re: Simple overflow error [message #33774 is a reply to message #33770] |
Tue, 28 January 2003 15:32  |
Mark Hadfield
Messages: 783 Registered: May 1995
|
Senior Member |
|
|
"Mike Chinander" <mchinand@midway.uchicago.edu> wrote:
> New2IDL <biomedthesis2002@yahoo.com> wrote:
>
>> I have a small problem with overflow.
>>
>> a = 200 * 200
>>
>> I get the answer as a negative no. can anybody please tell me how
>> to fix this.
>
> Make at least one of your integers a LONG .
>
> a=200L*200
Or, in recent IDL versions, include a "compile_opt IDL2" or
"compile_opt DEFINT32" command at the start of each program unit. If
you put one in your startup file it sets the options for expressions
you type in at the command line.
--
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
|
|
|
|