These are examples that illustrate a 'before' and 'after' version of a one-dimensional Newton method code for solving an equation f(x)=0. The before version, test.f, has statement labels and uses a withdrawn feature of Fortran, alternate return subprogram arguments. These implement reverse communication. This constuct provides the function and derivative values required by Newton's method.

The after version, test2.f90, uses the same logic as test.f, but has removed the alternate returns and the statement labels. In their place is a select case construct based on an additional integer flag.

Two executables may be generated using the makefile

Sample output from test

Solution and absolute error:
  0.9000E+00  0.5960E-07

Sample output from test2

Solution and absolute error:
  0.9000E+00  0.5960E-07