Commit cc7d6917 authored by Bruce Cowan's avatar Bruce Cowan

A few minor changes

* Add legacy option to F77 program
* Use newer array syntax
* Better print formatting
parent 0df2277a
......@@ -11,7 +11,7 @@ program euclid
read (*,*) b
b = abs(b)
print '("The GCD of ", i0, " and ", i0, " is ", i0)', a, b, gcd_rec(a, b)
print '(a, i0, a, i0, a, i0)', "The GCD of ", a, " and ", b, " is ", gcd_rec(a, b)
contains
......
......@@ -11,8 +11,8 @@ C Find greatest common divisor using the Euclidean algorithm
IF (NB.LT.0) THEN
NB = ABS(NB)
END IF
PRINT '("The GCD of ", (i0), " and " (i0), " is " (i0))', NA,
* NB, NGCD(NA, NB)
PRINT '(A, I0, A, I0, A, I0)', "THE GCD OF ", NA, " AND ", NB,
* " IS ", NGCD(NA, NB)
STOP
END
......
executable('euclid', 'euclid.f')
executable('euclid', 'euclid.f', fortran_args: '-std=legacy')
......@@ -4,16 +4,15 @@ use iso_fortran_env, only: dp=>real64
implicit none
real(dp) :: M(2)
real(dp), dimension(2) :: M
real(dp) :: ecc
real(dp) :: E(2)
real(dp), dimension(2) :: E
M(1) = 2.0084512_dp
M = [2.0084512_dp, 0.0_dp]
ecc = 0.00877_dp
! E should be ~2.016365
M(2) = 0_dp
! E should be 0
! E should be ~2.016365 for M(1)
! E should be 0 for M(2)
call solve_kepler(M, ecc, E)
print *, E(1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment