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

Home » Public Forums » archive » readf,1,format= ......
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: Readf [message #70209 is a reply to message #57392] Fri, 19 March 2010 05:51 Go to previous message
Maarten[1] is currently offline  Maarten[1]
Messages: 176
Registered: November 2005
Senior Member
On Mar 19, 12:51 pm, bing999 <thibaultga...@gmail.com> wrote:

> i have written a file in fortran this way:
>
> write(444,'(e14.6,1x,e14.6,1x,e14.6)',advance='yes') A, B, C
>
> where A has a value of 2.10^60 and the other ones 0.0000000
>
> The file is printed correctly but when i want to read it with IDL:
>
> readf,11,format='(e14.6,1x,e14.6,1x,e14.6)', A, B, C
>
> It displays Inf for A and 0.0000000 for B and C.
>
> However, it is the same format I don't understand why it prints Inf
> for A ( even if i initialize A = 0.d0)

Make sure A is double precision. 2.10^60 is beyond the range of float.

IDL> a = 2D60
IDL> b = float(a)
% Program caused arithmetic error: Floating overflow
IDL> help
% At $MAIN$
A DOUBLE = 2.0000000e+60
B FLOAT = Inf

If you make sure that a, b, and c exist before the read statement (as
double precision floats), then all is well. I sure would like to have
a compile_opt to use doubles by default.

Maarten
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Readf
Next Topic: PLOT x and y ranges

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

Current Time: Sat Oct 11 06:56:34 PDT 2025

Total time taken to generate the page: 2.07645 seconds