Re: Reads Precision Error? [message #3670] |
Mon, 06 March 1995 09:38 |
chase
Messages: 62 Registered: May 1993
|
Member |
|
|
>>>> > "Christopher" == Christopher McCarthy <chris@sfsu.edu> writes:
In article <3jbsjr$29f@news.csus.edu> chris@sfsu.edu (Christopher McCarthy) writes:
Christopher> three = [0.123456789012345d0,1.d0,1.d0]
Christopher> a = 1.d0 & b = 1.d0 & c=1.d0 ;initalize double
Christopher> reads,three,a,b,c
Christopher> print,three(0),a,f='(D40.30)'
Christopher> And you get:
Christopher> 0.123456789012344997358283649191
Christopher> 0.123456789999999996809698643574
three is not a string. READS takes a string for the first argument
(like the corresponding FORTRAN statement). The "IDL Reference Guide"
states that if the "supplied argument is not a string, it is
automatically converted." It probably does the conversion the same
way as the STRING command (I believe it uses the default list-directed
formats explained in the User Guide chapter on I/O).
To see what conversion result do this:
s=strarr(3)
reads,three,s
print,s
0.12345679 1.0000000 1.0000000
The commands below should give you what you expect:
three=['0.123456789012345d0','1.d0','1.d0'] ; string argument
a = 1.d0 & b = 1.d0 & c=1.d0 ;initalize double
reads,three,a,b,c
print,a,f='(D40.30)'
0.123456789012344990000000000000
Chris
--
===============================
Bldg 24-E188
The Applied Physics Laboratory
The Johns Hopkins University
Laurel, MD 20723-6099
(301)953-6000 x8529
chris.chase@jhuapl.edu
|
|
|