MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: read real*8 binary

  • To: mathgroup at
  • Subject: [mg97504] Re: read real*8 binary
  • From: David Bailey <dave at>
  • Date: Sat, 14 Mar 2009 05:41:05 -0500 (EST)
  • References: <gp7vus$1f4$>

Jan Schmedes wrote:
> Dear group,
> I have a fortran program which writes a real array into a binary file.  
> This binary file I could read without problems using  
> Import["..."."Real32"]; But when I changed real to real*8 in the  
> fortran program I could not read the file anymore (I used "Real64"  
> instead of  "Real32"), meaning I get numbers like 10^275. I used the  
> same fortran compiler (ifort 10) and the same computer (Mac Pro) in  
> both computations.
> Anyone has an idea why this does not work???
> Thank you!
> Jan
This sounds rather puzzling to me.I would write a mini Fortran program 
to output a number of REAL*8 numbers with known bit patterns - possibly 
equivalencing them to integers so that you can print out the exact bit 
pattern. Then you can check with a hex editor that the resultant file 
actually contains the bit patterns you expect. My guess is that there is 
a typo in your program somewhere.

Have you checked that your Fortran program is actually producing the 
numbers you expect. For example, when you changed to REAL*8, did you end 
up calling a function that required a REAL*4 with an argument that was 
now REAL*8 perhaps.

David Bailey

  • Prev by Date: Re: Return Ambiguity
  • Next by Date: Re: Notebook that auto-executes when opened?
  • Previous by thread: read real*8 binary
  • Next by thread: Re: Wolfram/Alpha (Wikipedia page restored)