Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations SE2607 on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Binary write format for Real

Status
Not open for further replies.

rih5342

Marine/Ocean
May 8, 2007
40
Below is a sample of a code that runs with Intel but not GFORTRAN.
Writing a real in binary format is an extension of the Fortran standard.

My Question:
What is the best way to do this?
How do you extract the binary of a real for printing?

Thank you.

IMPLICIT NONE
integer :: ii = 1
real :: xx = 1.0e00

write(*,'(1x, a7, 1x, b32.32)') ' ii = ', ii

! next line runs with IVF but not GFORTRAN
write(*,'(1x, a7, 1x, b32.32)') ' xx = ', xx

end
 
Replies continue below

Recommended for you

Is this for school?

TTFN
faq731-376
7ofakss
 
It's not for school.
I guess I've been spoiled by IVF and was hoping for a work around.
 
PROGRAM real_binary_format
IMPLICIT NONE
integer :: jj
integer :: ii = 1
real :: xx = 1.0e00

write(*,'(/,1x,a20)') ' real_binary_format '

write(*,'(1x, a7, 1x, b32.32)') ' ii = ', ii

jj = transfer(xx,ii)
write(*,'(1x, a7, 1x, b32.32)') ' xx = ', jj

end program real_binary_format
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor