program test_xp_1

	! vypocet exp(x) souctem zadaneho poctu clenu mocninne rady
	! pri zadanem poctu dekadickych cifer
	! exp(x) = 1 + x + x^2/2! + x^3/3! + ... + x^n/n!
	
	
	use std_type
	use VstupVystup
	use xp_module

	implicit none

	real(DP) :: xr
	type(xp_real) :: x, clen, soucet
	integer :: cifer,i,clenu
	
	call cti_cislo("Zadej pocet platnych cifer ",cifer)
	call cti_cislo("Zadej pocet clenu rady ",clenu)
	
	JBASE = 10
	NDIG = cifer
	JFORM1 = 2			! vystup v f formatu
	JFORM2 = NDIG+10		! pocet cifer za desetinou teckou
	
	! pocitat exp(x) jako soucet rady
	call cti_cislo("Zadej argument pro exp(x) ",xr)
	x = xr
	clen = 1.0
	soucet = clen
	i = 1
	do
		print *,i
		call xp_print(clen)
		call xp_print(soucet)		
		clen = clen*(x/i)
		soucet = soucet+clen
		i=i+1
		if (i>clenu) exit
	end do
	
	print *,char(10)//"Presna hodnota =",exp(xr)
	read *

end program test_xp_1
