<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://www.vigyanwiki.in/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://www.vigyanwiki.in/index.php?action=history&amp;feed=atom&amp;title=Module%3APercentage"/>
	<link rel="alternate" type="text/html" href="https://www.vigyanwiki.in/index.php?title=Module:Percentage&amp;action=history"/>
	<updated>2026-05-11T13:54:39Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://www.vigyanwiki.in/index.php?title=Module:Percentage&amp;diff=109308&amp;oldid=prev</id>
		<title>Indicwiki: 1 revision imported from :alpha:Module:Percentage</title>
		<link rel="alternate" type="text/html" href="https://www.vigyanwiki.in/index.php?title=Module:Percentage&amp;diff=109308&amp;oldid=prev"/>
		<updated>2023-03-16T04:40:55Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported from &lt;a href=&quot;https://alpha.indicwiki.in/index.php?title=Module:Percentage&quot; class=&quot;extiw&quot; title=&quot;alpha:Module:Percentage&quot;&gt;alpha:Module:Percentage&lt;/a&gt;&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-GB&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 10:10, 16 March 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en-GB&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>Indicwiki</name></author>
	</entry>
	<entry>
		<id>https://www.vigyanwiki.in/index.php?title=Module:Percentage&amp;diff=109307&amp;oldid=prev</id>
		<title>alpha&gt;Indicwiki: Created page with &quot;-- -- This module implements Template:Percentage -- local p = {}  local math_module = require( &quot;Module:Math&quot; ) local precision = math_module._precision local sortkey = req...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.vigyanwiki.in/index.php?title=Module:Percentage&amp;diff=109307&amp;oldid=prev"/>
		<updated>2022-07-19T06:42:25Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;-- -- This module implements &lt;a href=&quot;/wiki/Template:Percentage&quot; title=&quot;Template: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 = req...&amp;quot;&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 '', '^%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*$') then&lt;br /&gt;
		local a,b,c,d = mw.ustring.match(num or '', '^%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*$')&lt;br /&gt;
		d = tonumber(d) or 1&lt;br /&gt;
		if c ~= '' then&lt;br /&gt;
			return '0.' .. mw.ustring.rep('0', d - 1) .. a .. b&lt;br /&gt;
		else&lt;br /&gt;
			return a .. mw.ustring.sub(b .. mw.ustring.rep('0', 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;lt;span data-sort-value=&amp;quot;'&lt;br /&gt;
			.. sortkey._sortKeyForNumber(pct) .. '♠&amp;quot; style=&amp;quot;display:none&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;'&lt;br /&gt;
&lt;br /&gt;
	-- prec = math.floor(prec)&lt;br /&gt;
&lt;br /&gt;
	if sigfig ~= '' 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 ~= '' 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('Module:Yesno')&lt;br /&gt;
	return _percentage(&lt;br /&gt;
		tonumber(args[1]) or 0,&lt;br /&gt;
		tonumber(args[2]) or 100,&lt;br /&gt;
		tonumber(args[3]) or tonumber(args['pad']) or 0,&lt;br /&gt;
		args['%'] or '%', args['pad'] or '',&lt;br /&gt;
		args['sigfig'] or '',&lt;br /&gt;
		yesno(args['nonscinote'] or 'no')&lt;br /&gt;
		)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>alpha&gt;Indicwiki</name></author>
	</entry>
</feed>