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

Home » Public Forums » archive » Re: IDL is giving me a syntax error out of nowhere
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: IDL is giving me a syntax error out of nowhere [message #62534] Tue, 16 September 2008 07:37
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
ben.bighair writes:

> Wow! Your boys must be from Lake Woebegone!

Did I say "like children"? I meant "unlike children". :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: IDL is giving me a syntax error out of nowhere [message #62535 is a reply to message #62534] Tue, 16 September 2008 07:28 Go to previous message
ben.bighair is currently offline  ben.bighair
Messages: 221
Registered: April 2007
Senior Member
On Sep 16, 8:56 am, David Fanning <n...@dfanning.com> wrote:
> Ryan. writes:
>> I guess the trick I used before was that I actually remembered what a
>> Long Integer, Float and Double were! I must have been too frustrated
>> with it not working to stop and think about it for a moment.
>
> Yeah, try to remember that programs, like children, usually
> do what we have programmed them to do. :-)
>

Wow! Your boys must be from Lake Woebegone!
Re: IDL is giving me a syntax error out of nowhere [message #62537 is a reply to message #62535] Tue, 16 September 2008 05:56 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Ryan. writes:

> I guess the trick I used before was that I actually remembered what a
> Long Integer, Float and Double were! I must have been too frustrated
> with it not working to stop and think about it for a moment.

Yeah, try to remember that programs, like children, usually
do what we have programmed them to do. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: IDL is giving me a syntax error out of nowhere [message #62538 is a reply to message #62537] Tue, 16 September 2008 05:47 Go to previous message
Ryan. is currently offline  Ryan.
Messages: 77
Registered: March 2006
Member
> maybe you should check the descriptions of Integers, Longs, Floats and
> Double... there is nothing wrong with your program:

Thanks Jean and David,

I guess the trick I used before was that I actually remembered what a
Long Integer, Float and Double were! I must have been too frustrated
with it not working to stop and think about it for a moment.

Thanks again,
Ryan.
Re: IDL is giving me a syntax error out of nowhere [message #62549 is a reply to message #62538] Mon, 15 September 2008 12:40 Go to previous message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
Hi,

maybe you should check the descriptions of Integers, Longs, Floats and
Double... there is nothing wrong with your program:

> IDL> getoccid, 1228694696.289
> The occultation with ID 1.22869e+09 is:
> -999

max float is 10^38 (fine), with 7 decimal places of significance. The
result you expect has more than 7 decimal digits.


> IDL> getoccid, 1228694696.289L
> getoccid, 1228694696.289L
> % Syntax error.

Long is a 32 bits INTEGER... no places for decimals. It is a normal
behavior. Try a = 1.2L ... it will give you the same error!

> IDL> getoccid, long(1228694696.289)
> The occultation with ID 1228694656 is:
> -999

Same problem as the first one. Your number is, by default, a float. The
result you get (ending in 656) is well within the float accuracy.
Also, by making it a long, you do trim the decimals.

> IDL> getoccid, 1228694696.289UL
> getoccid, 1228694696.289UL
> % Syntax error.

Same as above. No decimals in an Unsigned Long.


> I know what is wrong with the first command, but the last 3 should not
> have any problems, especially syntax problems. If you see the third
> call to the procedure (with the long(...) argument), the display at the
> end of the routine has the wrong number so it is not taking in the
> correct value for the argument. I used this routine last year and it
> was working fine, but I can't remember the trick to get it to work.
>
> Any insights into this problem would be greatly appreciated,
> Ryan.

So, what you really want is, I guess, to pass a DOUBLE. Try
getoccid, 1228694696.289D

doubles have up to 14 decimal places of significance.

Of course, it also depend on what you are doing in your function with
that value... don't type cast it anymore!

Jean
Re: IDL is giving me a syntax error out of nowhere [message #62550 is a reply to message #62549] Mon, 15 September 2008 12:31 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Ryan. writes:

> Any insights into this problem would be greatly appreciated,

Well, long integers don't have an decimal points in them:

IDL> print, 12345.678L

print, 12345.678L
^
Syntax error.

When you cast the float to a LONG, it becomes a long,
but the value cannot be determined the way you are
trying to use it, hence the error.

Cheers,

David
--
David Fanning, Ph.D.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: LEGENDRE problem
Next Topic: Re: very simple Index question~~~help~~~

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

Current Time: Thu Oct 09 09:20:26 PDT 2025

Total time taken to generate the page: 2.00167 seconds