! Exemplul Mueller-Kahan
! Kahan (2006): "How Futile are Mindless Assessments of Roundoff in Floating-Point Computation ?"
!
! f(y,z) =108.-(815.-1500./z)/y
! x_0 =4; x_1 =4.25; x_(n+1) =f(x_n, x_(n-1))
! 
! Calculati x_n pt. n "mare": n ~ 80
! Limita corecta: x_n --> 5
! 
!

implicit real(8) (d)

df(dy,dz) =108.-(815.-1500./dz)/dy

open(1, file ='K-M-d.rez',status ='unknown', form ='formatted')

write(1, '(/,t11,a, t40,a)') ' Double Precision (53)'

! Initialize:
dx0 = 4d0
dx1 = 4.25d0 

! Compute:
do i=1,81,5

dxi =df(dx1,dx0)

write(1,*) i, dxi

dx0 =dx1
dx1 =dxi

enddo


close(1)

write(*, '(a, /)') 'Result File: "K-M-d.rez"'

END