Module:Frac

Une page de Wikipédia, l'encyclopédie libre.

 Documentation[voir] [modifier] [historique] [purger]

Ce module est destiné à faire des essais. Ce module est rattaché à la page Utilisatrice:Lydie Noria/Bac à sable. Les fonctions présentes dans ce module, ne sont là que pour des besoins d'expérimentation et peuvent disparaître inopinément.

local p = {}
 
function ent(x)
	local y
	y = math.modf(x)
	return y
end

function frac(x)
	local y
	y = math.modf(x)
	y = x - y
	return y
end

function p.mariage(frame)
	return frame.args[1] .. " et " .. frame.args[2]
end


function p.traduit(frame)
	local reponse = "Je ne sais pas"
	if frame.args[1] == "Lundi" then reponse = "Monday" end
	if frame.args[1] == "Mardi" then reponse = "Tuesday" end
	if frame.args[1] == "Mercredi" then reponse = "Wednesday" end
	if frame.args[1] == "Jeudi" then reponse = "Thursday" end
	if frame.args[1] == "Vendredi" then reponse = "Friday" end
	if frame.args[1] == "Samedi" then reponse = "Saturday" end
	if frame.args[1] == "Dimanche" then reonse = "Sunday" end
	return reponse
end


function p.colle(frame)
	local x, num, den, n
	x = frame.args[1]
	n = ent(x)
	num = n
	den = 1
	x = x - n
	x = 1/x
	n = ent(x)
	num = num*n + den
	den = den*n
    return "La fraction approchés est "..num.."/"..den
end

function p.hello(frame)
	local x
	local n = {}
	x = frame.args[1]
	for
		i = 1, 7
	do
		n[i] = tostring( math.modf( x ) )
		x = x - n[i]
		x = 1/x
	end
	return n
end
 
return p