<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://ml.sayahna.org/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="http://ml.sayahna.org/index.php?action=history&amp;feed=atom&amp;title=Module%3ADecimals"/>
	<link rel="alternate" type="text/html" href="http://ml.sayahna.org/index.php?title=Module:Decimals&amp;action=history"/>
	<updated>2026-04-24T06:38:06Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.5</generator>
	<entry>
		<id>http://ml.sayahna.org/index.php?title=Module:Decimals&amp;diff=12532&amp;oldid=prev</id>
		<title>Cvr: 1 revision</title>
		<link rel="alternate" type="text/html" href="http://ml.sayahna.org/index.php?title=Module:Decimals&amp;diff=12532&amp;oldid=prev"/>
		<updated>2014-08-22T07:26:42Z</updated>

		<summary type="html">&lt;p&gt;1 revision&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&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: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 07:26, 22 August 2014&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>Cvr</name></author>
		
	</entry>
	<entry>
		<id>http://ml.sayahna.org/index.php?title=Module:Decimals&amp;diff=12531&amp;oldid=prev</id>
		<title>Jackmcbarn: use mw.ext.ParserFunctions.expr</title>
		<link rel="alternate" type="text/html" href="http://ml.sayahna.org/index.php?title=Module:Decimals&amp;diff=12531&amp;oldid=prev"/>
		<updated>2014-07-04T22:05:40Z</updated>

		<summary type="html">&lt;p&gt;use mw.ext.ParserFunctions.expr&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;require('Module:No globals')&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('Unable to convert &amp;quot;' .. tostring(n) .. '&amp;quot; to a number')&lt;br /&gt;
	end&lt;br /&gt;
	local decimals = tonumber(d)&lt;br /&gt;
	if not decimals then&lt;br /&gt;
		error('Unable to convert &amp;quot;' .. tostring(d) .. '&amp;quot; to a number')&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('%.' .. decimals .. 'f', 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>Jackmcbarn</name></author>
		
	</entry>
</feed>