[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rounding errors



Randall Skelton wrote:
> For the record, I had no idea that IDL requires you to explicitly state
> 'a=2.348339d0' instead of a=double(2.348339).

This is a subtle but important point. DOUBLE() is a type conversion
function, and 

a = double(2.348339)

shows a FLOAT argument being converted to a DOUBLE. The safest way to
'cast' a double variable is

a = 2.348339d

or use an array creation function such as DBLARR, DINDGEN, REPLICATE, or
MAKE_ARRAY, e.g.,

b = dblarr(10)
c = dindgen(10)
d = replicate(1.0d, 10)
e = make_array(10, /double)

Cheers,
Liam.
http://cimss.ssec.wisc.edu/~gumley