! Ecuatia de gradul 2 - pierdere de semnificatie
! x2 +40x +1 =0
! x1,2 =-20 +/-sqrt(399)
! x1_modoficat =1/x2
! xa = simpla precizie; 
! xT = dubla precizie (~ exact);

use ifcore  ! cvf: use dflib
real(4) x1a, x2a, x1aMod, rad
real(8) x1T, x2T, drad
real(4) rel1, rel2, rel1mod
logical pressed

rad =sqrt(399.)
drad =dsqrt(399D0)

x1a =-20 +rad; x2a =-20 -rad
x1aMod =1./x2a

x1T =-20d0 +drad; x2T =-20d0 -drad

rel1 =(sngl(x1T) -x1A)/sngl(x1T); rel2 =(sngl(x2T) -x2A)/sngl(x2T)
rel1Mod =(sngl(x1T) -x1aMod)/sngl(x1T)

print *,' Valorile aproximative si exacte'
print '(a, F13.8)',        'x1a:        ', x1a
print '(a, F13.8, F13.9)', 'x1aMod, x1T:', x1aMod, x1T


print '(/,a, F13.5, F13.6)', 'x2a, x2T:', x2a, x2T

print '(/,a)', ' Erori relative in x1; x1_modificat, x2:'
print *, Rel1, Rel1Mod, Rel2

write(*, '(/,a)') 'Apasa orice tasta'
DO WHILE (.NOT. pressed)   
pressed = PEEKCHARQQ ( )
END DO

end
