Skip to content

The epic Hello World program in the Fortran77 language

License

Notifications You must be signed in to change notification settings

ckormanyos/hello_f77

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hello_f77

Build Status Boost Software License 1.0

hello_f77 implements the epic Hello World program in FORTRAN77.

Compile on *nix

Use GCC to compile hello_f77.f. This requires the presence of fortran in the enabled languages of the GCC build (see image and description below). The libgfortran library must also be installed on the system for proper linking.

cd hello_f77
g++ hello_f77.f -x f77 -std=legacy -O2 -lgfortran -o hello_f77.exe

Query if fortran Is Available

If you are unsure if fortran is available, query GCC for the presence of fortran. Use the command shown below and search for fortran in the list of GCC's enabled languages.

g++ -v

Source Listing

The complete source is provided below. It can be found in hello_f77.f.

You can even try this program at the following short link to godbolt.

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C
C     Copyright Christopher Kormanyos 1985 - 2023.
C     Distributed under the Boost Software License,
C     Version 1.0. (See accompanying file LICENSE_1_0.txt
C     or copy at http://www.boost.org/LICENSE_1_0.txt)
C

C     g++ hello_f77.f -x f77 -std=legacy -O2 -lgfortran -o hello_f77.exe
C     See also https://godbolt.org/z/sMoP43Mcc

      PROGRAM HELLO
      IMPLICIT NONE

      CHARACTER*32 MY_TEXT

      MY_TEXT = 'Hello World'
      WRITE (*,*) MY_TEXT

      END

Historical Perspective

FORTRAN (in particular FORTRAN77 or f77) was there early in the game.

From a subjective standpoint, however, it seemed like there was an intermediate time epoch during which its support was lost, missing, or in some other way incomplete and obscure.

Now trusty old f77 is back. It is properly supported as part of GCC on many systems. There is also (as there should be) conformance with legacy code. This includes support for the $128$-bit floating-point data type REAL*16.

Even though REAL*16 (and its complex counterpart COMPLEX*32) are not used in Hello World, they are available for number crunching when needed. These high-precision types can be difficult to find in the world of high-performance, efficient, object-code-generating programming languages.

Even today this makes FORTRAN77 still a leading program for high-performance, high-precision numerical calculations.

About

The epic Hello World program in the Fortran77 language

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published