Giter Site home page Giter Site logo

scivision / fortran-ii-examples Goto Github PK

View Code? Open in Web Editor NEW
7.0 3.0 4.0 10 KB

Fortran II (year 1958) examples from IBM 704 manual, with modern Fortran equivalents

License: MIT License

Makefile 7.54% Fortran 90.37% Meson 2.09%
fortran-ii fortran66 fortran77 fortran fortran-language

fortran-ii-examples's Introduction

fortran-II-examples

Fortran II (year 1958) examples from IBM 704 Fortran II manual with modern Fortran equivalents.

The benchmark shows that good modern Fortran coding can be orders of magnitude faster than Fortran 77 techniques.

Requirements

Most Fortran compilers can handle the Fortran II code within. Of course there will be some compiler warnings.

Build / Usage

make
./bench

Benchmark

An arctan function is tested.

  • Intrinsic: Fortran built-in atan()
  • New: My implementatin in modern Fortran of the 1958 IBM arctangent function
  • Old: Fortran 77 implementation of 1958 IBM arctangent function

time in seconds. Optimization -O3

Flang 5.0 make FC=flang

./bench 1000000
intrinsic     1.740E-02  modern Fortran     6.861E-02  Fortran 77      6.119E-02

./bench 10000000
intrinsic     1.397E-01  modern Fortran     6.690E-01  Fortran 77      6.231E-01

Intel Fortran 2019 make FC=ifort

./bench 1000000
intrinsic     2.648E-03  modern Fortran     9.605E-02  Fortran 77      8.485E-02

./bench 10000000
intrinsic     2.596E-02  modern Fortran     9.397E-01  Fortran 77      8.574E-01

PGI 2017 make FC=pgf95

 ./bench 1000000
intrinsic     5.782E-03  modern Fortran     6.846E-02  Fortran 77      6.339E-02

./bench 10000000
intrinsic     3.290E-02  modern Fortran     7.069E-01  Fortran 77      6.356E-01

Using the same algorithm, modern Fortran 95+ techniques are approximately the same speed as awkward Fortran 77 style coding.

Notes

Subprograms/program units (now known as "procedures" e.g. functions and subroutines) must be concluded for Fortran II (1958) with

RETURN
END

However, since Fortran 66, all that's needed for ending procedures (functions and subroutines) is

END

so there's no need to be anachronistic--just end with end subroutine or end function

Function statements

The original 1957 Fortran had "statement functions", which in 1957 Fortran and Fortran II were required to have a name ending in F e.g. MINIMAXF.

fortran-ii-examples's People

Contributors

scivision avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.