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

Home » Public Forums » archive » Strange Bug with numeric double constants
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
Strange Bug with numeric double constants [message #14711] Mon, 22 March 1999 00:00 Go to next message
Alex Schuster is currently offline  Alex Schuster
Messages: 124
Registered: February 1997
Senior Member
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.

Alex
--
Alex Schuster Wonko@weird.cologne.de PGP Key available
alex@pet.mpin-koeln.mpg.de
Re: Strange Bug with numeric double constants [message #14742 is a reply to message #14711] Thu, 25 March 1999 00:00 Go to previous message
badastro is currently offline  badastro
Messages: 7
Registered: August 1998
Junior Member
In comp.lang.idl-pvwave Alex Schuster <alex@rosa.mpin-koeln.mpg.de> wrote:
> 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?

Nope. ;-) IDL expects that what follows the 'd' is the exponent,
like 100 being 1.d2 or 1.d+2. If you put a 'd' after the 2, it doesn't
recognize it as being part of the exponent, so it barfs. The same
things happens if you use an 'e' instead of 'd'. It doesn't happen
with byte numbers because the 'b' doesn't precede an exponent.

* * * * * The Bad Astronomer * * * *

Phil Plait badastro@badastronomy.com
The Bad Astronomy Web Page: http://www.badastronomy.com
Re: Strange Bug with numeric double constants [message #14747 is a reply to message #14711] Thu, 25 March 1999 00:00 Go to previous message
Alex Schuster is currently offline  Alex Schuster
Messages: 124
Registered: February 1997
Senior Member
William Thompson wrote:

> Alex Schuster <alex@rosa.mpin-koeln.mpg.de> writes:

>> I just experienced some weird IDL behaviour:
>
>> IDL> help, 1.0d+2.0d
>
>> help, 1.0d+2.0d
>> ^
>> % Syntax error.
[...]

> Wouldn't it be more proper to write these numbers as
>
> IDL> help, 1.0d0+2.0d0

Okay-okay, I admit that IDL is correct... this time :)

Alex
--
Alex Schuster Wonko@weird.cologne.de PGP Key available
alex@pet.mpin-koeln.mpg.de
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Can't create pixmap
Next Topic: Re: help: Type & size checking

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

Current Time: Wed Oct 08 13:41:49 PDT 2025

Total time taken to generate the page: 0.00606 seconds