Re: Grumbling about setting double precision [message #78765 is a reply to message #78763] |
Wed, 21 December 2011 08:16   |
greg.addr
Messages: 160 Registered: May 2007
|
Senior Member |
|
|
Ok, a simple assignment would have to be converted to float (unless specified with the D) to retain the usual IDL behaviour:
a=24.5 {internally a=float(24.5d) }
but
b=[24.5d,9999.9] would then work as expected, since the assigned values (which are apparently copied into the dblarr after being read somewhere else) would already be doubles. In this case, the array type comes from the first element as usual (float unless specified otherwise), so
c=[24.5,9999.9] should likewise produce a satisfactory float array.
The other example from your page,
array = Make_Array(3, Value=9999.9, /Double)
is a tricky one. Normally you would use
array = Make_Array(3, Value=9999.9d)
to make a dblarr() with a specific value, which is fine (and /double for a zeroed array). Here, you're specifically converting the float to a double - I think there's no harm to leave that effect as it is.
Wouldn't that work?
cheers,
Greg
|
|
|