<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://signal-12.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3ADecimals</id>
	<title>Module:Decimals - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://signal-12.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3ADecimals"/>
	<link rel="alternate" type="text/html" href="https://signal-12.com/wiki/index.php?title=Module:Decimals&amp;action=history"/>
	<updated>2026-06-04T01:35:41Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://signal-12.com/wiki/index.php?title=Module:Decimals&amp;diff=867&amp;oldid=prev</id>
		<title>Admin: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://signal-12.com/wiki/index.php?title=Module:Decimals&amp;diff=867&amp;oldid=prev"/>
		<updated>2017-03-21T01:09:11Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;require(&amp;#039;Module:No globals&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
function p._main(n, d)&lt;br /&gt;
	local num = tonumber(n)&lt;br /&gt;
	if not num then&lt;br /&gt;
		error(&amp;#039;Unable to convert &amp;quot;&amp;#039; .. tostring(n) .. &amp;#039;&amp;quot; to a number&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
	local decimals = tonumber(d)&lt;br /&gt;
	if not decimals then&lt;br /&gt;
		error(&amp;#039;Unable to convert &amp;quot;&amp;#039; .. tostring(d) .. &amp;#039;&amp;quot; to a number&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
	local maxDecimals = 14 - math.floor(math.log10(num)) -- to allow a maximum of 15 significant figures, which is the highest guaranteed correct with doubles&lt;br /&gt;
	if decimals &amp;gt; maxDecimals then decimals = maxDecimals end&lt;br /&gt;
	local mult = 10^decimals&lt;br /&gt;
	num = math.floor(num * mult + 0.5) / mult&lt;br /&gt;
	if decimals &amp;lt; 0 then&lt;br /&gt;
		return tostring(num)&lt;br /&gt;
	else&lt;br /&gt;
		return string.format(&amp;#039;%.&amp;#039; .. decimals .. &amp;#039;f&amp;#039;, num)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	local args, pargs = frame.args, frame:getParent().args&lt;br /&gt;
	return p._main(mw.ext.ParserFunctions.expr(args[1] or pargs[1]), mw.ext.ParserFunctions.expr(args[2] or pargs[2]))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>