<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://prdmc.ca/w/index.php?action=history&amp;feed=atom&amp;title=Module%3APercentage</id>
	<title>Module:Percentage - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://prdmc.ca/w/index.php?action=history&amp;feed=atom&amp;title=Module%3APercentage"/>
	<link rel="alternate" type="text/html" href="https://prdmc.ca/w/index.php?title=Module:Percentage&amp;action=history"/>
	<updated>2026-04-15T02:20:31Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://prdmc.ca/w/index.php?title=Module:Percentage&amp;diff=621&amp;oldid=prev</id>
		<title>RandomUser34: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://prdmc.ca/w/index.php?title=Module:Percentage&amp;diff=621&amp;oldid=prev"/>
		<updated>2026-02-15T04:56:42Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 04:56, 15 February 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>RandomUser34</name></author>
	</entry>
	<entry>
		<id>https://prdmc.ca/w/index.php?title=Module:Percentage&amp;diff=620&amp;oldid=prev</id>
		<title>wp&gt;Ahecht: Since we&#039;re already loading Module:Math, use that instead of mw.language.getContentLanguage():parseFormattedNumber</title>
		<link rel="alternate" type="text/html" href="https://prdmc.ca/w/index.php?title=Module:Percentage&amp;diff=620&amp;oldid=prev"/>
		<updated>2025-11-13T16:52:52Z</updated>

		<summary type="html">&lt;p&gt;Since we&amp;#039;re already loading &lt;a href=&quot;/w/index.php/Module:Math&quot; title=&quot;Module:Math&quot;&gt;Module:Math&lt;/a&gt;, use that instead of mw.language.getContentLanguage():parseFormattedNumber&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&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;
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;
		if pct ~= 0 then&lt;br /&gt;
			return skey .. fmtout(rnd(pct, tonumber(sigfig) - oom(pct) - 1), sn) .. suffix&lt;br /&gt;
		else&lt;br /&gt;
			return skey .. fmtout(rnd(pct, tonumber(sigfig) - 3), sn) .. suffix&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if pad ~= &amp;#039;&amp;#039; then&lt;br /&gt;
		return skey .. 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 .. 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>wp&gt;Ahecht</name></author>
	</entry>
</feed>