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 
Return to the default flat view Create a new topic Submit Reply
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 messageGo 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
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: LEGENDRE problem
Next Topic: Re: very simple Index question~~~help~~~

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

Current Time: Sun Oct 12 13:19:16 PDT 2025

Total time taken to generate the page: 2.31941 seconds