[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Strange Bug with numeric double constants
- Subject: Re: Strange Bug with numeric double constants
- From: thompson(at)orpheus.nascom.nasa.gov (William Thompson)
- Date: 22 Mar 1999 23:58:49 GMT
- Newsgroups: comp.lang.idl-pvwave
- Organization: NASA Goddard Space Flight Center -- Greenbelt, Maryland USA
- References: <36F645F2.45DB@rosa.mpin-koeln.mpg.de>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:14031
Alex Schuster <alex@rosa.mpin-koeln.mpg.de> writes:
>Hi!
>I just experienced some weird IDL behaviour:
>IDL> help, 1.0d+2.0d
>help, 1.0d+2.0d
> ^
>% Syntax error.
>IDL> help, 1d+2d
>help, 1d+2d
> ^
>% Syntax error.
>Strange, isn't it? There's no problem with byte constants:
>IDL> help, 1b+2b
><Expression> BYTE = 3
>An additional blank helps:
>IDL> help, 1d +2d
><Expression> DOUBLE = 3.0000000
>I didn't try IDL 5.2, but it happened with 4.0 and 5.1 on Unix and
>Windows. I guess IDL expects an exponential notation like 1d0, and is
>confused by the nonnumeric plus character.
Wouldn't it be more proper to write these numbers as
IDL> help, 1.0d0+2.0d0
As others have pointed out, IDL is getting confused by putting the +2
immediately after the "d"--it thinks it's part of the exponent. I guess that
IDL usually knows what you meant if you leave the exponent off, but not always
as you found out.
Cheers,
William Thompson