×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Binary write format for Real

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

RE: Binary write format for Real

(OP)
It's not for school.
I guess I've been spoiled by IVF and was hoping for a work around.

RE: Binary write format for Real

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources