<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://wiki.politik-sim.de/index.php?action=history&amp;feed=atom&amp;title=Modul%3APercentage</id>
	<title>Modul:Percentage - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.politik-sim.de/index.php?action=history&amp;feed=atom&amp;title=Modul%3APercentage"/>
	<link rel="alternate" type="text/html" href="https://wiki.politik-sim.de/index.php?title=Modul:Percentage&amp;action=history"/>
	<updated>2026-09-10T11:36:24Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in vBundesrepublik</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://wiki.politik-sim.de/index.php?title=Modul:Percentage&amp;diff=205&amp;oldid=prev</id>
		<title>Administrator: Die Seite wurde neu angelegt: „-- -- This module implements Template:Percentage -- local p = {}  local math_module = require( &quot;Module:Math&quot; ) local precision = math_module._precision local sortkey = require( &quot;Module:Sortkey&quot; )  local function rnd(num, digits) 	-- This function implements {{rnd}} 	return math_module._precision_format(tostring(num), digits) end  local function oom(num) 	-- This function implements {{order of magnitude}} 	return math_module._order(tostring(num)) end…“</title>
		<link rel="alternate" type="text/html" href="https://wiki.politik-sim.de/index.php?title=Modul:Percentage&amp;diff=205&amp;oldid=prev"/>
		<updated>2026-09-06T20:51:07Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „-- -- This module implements &lt;a href=&quot;/index.php?title=Vorlage:Percentage&quot; title=&quot;Vorlage:Percentage&quot;&gt;Template:Percentage&lt;/a&gt; -- local p = {}  local math_module = require( &amp;quot;Module:Math&amp;quot; ) local precision = math_module._precision local sortkey = require( &amp;quot;Module:Sortkey&amp;quot; )  local function rnd(num, digits) 	-- This function implements {{rnd}} 	return math_module._precision_format(tostring(num), digits) end  local function oom(num) 	-- This function implements {{order of magnitude}} 	return math_module._order(tostring(num)) end…“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--&lt;br /&gt;
-- This module implements [[Template:Percentage]]&lt;br /&gt;
--&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local math_module = require( &amp;quot;Module:Math&amp;quot; )&lt;br /&gt;
local precision = math_module._precision&lt;br /&gt;
local sortkey = require( &amp;quot;Module:Sortkey&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
local function rnd(num, digits)&lt;br /&gt;
	-- This function implements {{rnd}}&lt;br /&gt;
	return math_module._precision_format(tostring(num), digits)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function oom(num)&lt;br /&gt;
	-- This function implements {{order of magnitude}}&lt;br /&gt;
	return math_module._order(tostring(num))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function _nonscinote(num)&lt;br /&gt;
	-- This function undoes scientific notation&lt;br /&gt;
	if mw.ustring.match(num or &amp;#039;&amp;#039;, &amp;#039;^%s*(%d)%.(%d+)&amp;lt;span[^&amp;lt;&amp;gt;]*&amp;gt;×&amp;lt;/span&amp;gt;10&amp;lt;sup&amp;gt;([%-−]*)(%d)&amp;lt;/sup&amp;gt;%s*$&amp;#039;) then&lt;br /&gt;
		local a,b,c,d = mw.ustring.match(num or &amp;#039;&amp;#039;, &amp;#039;^%s*(%d)%.(%d+)&amp;lt;span[^&amp;lt;&amp;gt;]*&amp;gt;×&amp;lt;/span&amp;gt;10&amp;lt;sup&amp;gt;([%-−]*)(%d)&amp;lt;/sup&amp;gt;%s*$&amp;#039;)&lt;br /&gt;
		d = tonumber(d) or 1&lt;br /&gt;
		if c ~= &amp;#039;&amp;#039; then&lt;br /&gt;
			return &amp;#039;0.&amp;#039; .. mw.ustring.rep(&amp;#039;0&amp;#039;, d - 1) .. a .. b&lt;br /&gt;
		else&lt;br /&gt;
			return a .. mw.ustring.sub(b .. mw.ustring.rep(&amp;#039;0&amp;#039;, d ), 1, d)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return num&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function fmtout(num,snote)&lt;br /&gt;
	if snote then&lt;br /&gt;
		return _nonscinote(num)&lt;br /&gt;
	else&lt;br /&gt;
		return num&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function fixminus(s)&lt;br /&gt;
	-- Converts a leading ASCII hyphen-minus (U+002D) to a Unicode minus sign (U+2212),&lt;br /&gt;
	-- preserving any leading padding whitespace. Only the sign of the number is touched.&lt;br /&gt;
	return (mw.ustring.gsub(tostring(s), &amp;#039;^(%s*)%-&amp;#039;, &amp;#039;%1−&amp;#039;))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function _percentage(n1, n2, prec, suffix, pad, sigfig, sn)&lt;br /&gt;
	local pct = 100*n1/n2&lt;br /&gt;
	skey = &amp;#039;&amp;lt;span data-sort-value=&amp;quot;&amp;#039;&lt;br /&gt;
			.. sortkey._sortKeyForNumber(pct) .. &amp;#039;♠&amp;quot; style=&amp;quot;display:none&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
	-- prec = math.floor(prec)&lt;br /&gt;
&lt;br /&gt;
	if sigfig ~= &amp;#039;&amp;#039; then&lt;br /&gt;
		local out&lt;br /&gt;
		if pct ~= 0 then&lt;br /&gt;
			out = fmtout(rnd(pct, tonumber(sigfig) - oom(pct) - 1), sn)&lt;br /&gt;
		else&lt;br /&gt;
			out = fmtout(rnd(pct, tonumber(sigfig) - 3), sn)&lt;br /&gt;
		end&lt;br /&gt;
		return skey .. fixminus(out) .. suffix&lt;br /&gt;
	end&lt;br /&gt;
	if pad ~= &amp;#039;&amp;#039; then&lt;br /&gt;
		return skey .. fixminus(fmtout(rnd(pct, prec), sn)) .. suffix&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	prec = (prec &amp;lt; 0) and 0 or prec&lt;br /&gt;
	if pct ~= 0 then&lt;br /&gt;
		pct = ((pct &amp;lt; 0) and -1 or 1)*math.floor(math.abs(pct * 10^prec) + 0.5) / 10^prec&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return skey .. fixminus(fmtout(pct, sn)) .. suffix&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	local args = frame.args[1] and frame.args or frame:getParent().args&lt;br /&gt;
	local yesno = require(&amp;#039;Module:Yesno&amp;#039;)&lt;br /&gt;
	return _percentage(&lt;br /&gt;
		math_module._cleanNumber(args[1] or 0, true) or 0,&lt;br /&gt;
		math_module._cleanNumber(args[2] or 100, true) or 100,&lt;br /&gt;
		tonumber(args[3]) or tonumber(args[&amp;#039;pad&amp;#039;]) or 0,&lt;br /&gt;
		args[&amp;#039;%&amp;#039;] or &amp;#039;%&amp;#039;, args[&amp;#039;pad&amp;#039;] or &amp;#039;&amp;#039;,&lt;br /&gt;
		args[&amp;#039;sigfig&amp;#039;] or &amp;#039;&amp;#039;,&lt;br /&gt;
		yesno(args[&amp;#039;nonscinote&amp;#039;] or &amp;#039;no&amp;#039;)&lt;br /&gt;
		)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Administrator</name></author>
	</entry>
</feed>