Binary write format for Real
Binary write format for Real
(OP)
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
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
RE: Binary write format for Real
TTFN
FAQ731-376: Eng-Tips.com Forum Policies
RE: Binary write format for Real
I guess I've been spoiled by IVF and was hoping for a work around.
RE: Binary write format for Real
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