Hi Nathan,
I don't think there's a precision problem with IDL's READS (or READF). At least, not on the platform that I use (Win2k).
For example:
d=0.0d0
t='1234567.8901234567'
reads,t,d
print,d,format='(d18.10)'
1234567.8901234567
(The same applies for a text file and READF.)
What I think is going on is that a FLOAT is creeping into your logic somewhere. Most probably, you aren't declaring the recipient variable for READS, in which case IDL automatically gives you a FLOAT variable. If you want DOUBLE, you have to declare the recipient variable as DOUBLE prior to READS (like in my example). It is no good casting the variable to double afterwards because the damage is already done by then.
e.g.,
;A is undefined at this point
READS,'1234567.8901234567',a ;IDL creates float A
val=double(a) ;too late!
print,val,,format='(d18.10)'
1234567.8750000000 ;see, too late!
HTH
Cheers
Peter Mason
|