! Test suma serie armonica
! Build with: "Floating Point Model: strict".

real(4) s_largest, s_smallest   ! single
real(8) s2  ! double
Real(16) s4 ! quadruple

open(1, file ='Arm-16.rez', status='unknown', form='formatted')
write(1,'(a)') ' TEST suma serie armonica'
write(1,'(a)') ' Numar termeni = 10^N'

write(1,*)
write(1,'(a)') &
' N    SUM_quad	SUM_smallest     SUM_largest     Rel_Err(smallest)  Rel_Err(largest)'


DO in =1,7
write(*,*) in

n =10**in

s_largest  =0.E0
s_smallest =0.E0
!s2 =0.D0
s4 =0.Q0

do j=1 ,n
s_largest =s_largest +1.E0/real(j)
s_smallest =s_smallest +1.E0/real((n+1-j))

!s2 =s2 +1.D0/dble(n+1-j)
s4 =s4 +1.Q0/qfloat(n+1-j)
end do

write(1,'(/, I2, 2x, 3(1pG14.7), 2x, 1pG14.3, 1pG14.3)') &
in, s4, s_smallest, s_largest, (s4-s_smallest)/s4, (s4-s_largest)/s4
END DO

close(1)
END
