! Test pentru: machine-epsilon; ULP; intrinsic function EPSILON.
use ifcore  ! cvf: use dflib

integer kind
logical pressed
character(11) fname, fname0*9, kind_char*2

fname0 ='Test_eps_'

write(*, '(a)') 'Precizia prin real(kind).'
write(*, '(a,\)') 'Introdu "kind" (4 =implicit; 8; 16): '
read(*,*) kind

if(.NOT. (kind ==4 .or. kind ==8 .or. kind ==16) ) then
write(*,'(/,a,/)') 'Valoare invalida. Se ia kind = 4.'
kind =4
endif

if(kind <=8) then
write(kind_char, '(I1)') kind
else
write(kind_char, '(I2)') kind
endif

fname =fname0//kind_char
open(1, file =fname)

select case(kind)
case(4)
write(1, '(a)') 'Precizie simpla (24 biti)'
call test_eps_4()

case(8)
write(1, '(a)') 'Precizie dubla (53 biti)'
call test_eps_8()

case(16)
write(1, '(a)') 'Precizie cvadrupla (113 biti)'
call test_eps_16()

end select

close(1)

write(*, '(a,a)') 'Fisier de iesire: ', fname
 
write(*, '(/,a)') 'Apasa orice tasta'
DO WHILE (.NOT. pressed)   
pressed = PEEKCHARQQ ( )
END DO

end

!---------------------------------------
