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

Home » Public Forums » archive » Re: Conversion Error?
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: Conversion Error? [message #16679] Mon, 16 August 1999 00:00
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Laurent Chardon (chardons@NOT_THISsprint.ca) writes:

> I can't figure this out. Is it a bug or something that I can not understand?
> This is with IDL 5.2 running on a PII 333 on Windows NT.
>
> If I do
>
> IDL> size=double(12990)
> IDL> help,size
> SIZE DOUBLE = 12990.000
> IDL> c=fltarr(size)
> IDL> help,c
>
> I get
>
> C FLOAT = Array[12990]
>
> which is what I expect.
>
> But... If I do
>
> IDL> size=(double(200-70.1))/0.01
> IDL> help,size
> SIZE DOUBLE = 12990.000
> IDL> c=fltarr(size)
> IDL> help,c
>
> I get
>
> C FLOAT = Array[12989]
>
> Does anyone know why??? I am starting to not trust any of my previous
> calculations done with IDL. Or is this a "feature" of the Pentium II?

I think your problem lies here:

IDL> size=(double(12990))
IDL> print, fix(size)
12990

IDL> size=(double(200-70.1))/0.01
IDL> print, fix(size)
12989

Of course, you need an *integer* as the argument of
FLTARR, since you can't have a partial element. Those
darn computer representations of numbers have done us
in again. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Previous Topic: Call Tree Generator
Next Topic: Dongles (was IDL>will not run)

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

Current Time: Wed Oct 08 19:12:26 PDT 2025

Total time taken to generate the page: 0.00414 seconds