Difference between revisions of "Template:Mod"

From Second Life Wiki
Jump to navigation Jump to search
m
 
(18 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>{{ifexpr:({{{1|0}}} > 2147483647) or ({{{1|0}}} < 0)|{{{2}}} +}}{{{1}}} mod {{{2}}}</includeonly><noinclude>{{{{PAGENAME}}|-1|2}}</noinclude>
<includeonly>{{#expr:{{#ifexpr:({{{1|0}}}) >= 2147483648|(((({{{1}}}) - 2147483648) mod ({{{2}}})) - ((-2147483648) mod ({{{2}}}))) mod ({{{2}}})|(({{{1}}}) mod ({{{2}}}))}}}}</includeonly><noinclude>
Why does this template exist? Because the internal #expr-mod function treats integers bigger then 2147483647 as negative, resulting in a useless answer. This is a partial solution, it is designed to only handles the range [2147483648, 4294967295].
 
Test: {{{{PAGENAME}}|2147483690|23}}
</noinclude>

Latest revision as of 18:05, 24 April 2007

Why does this template exist? Because the internal #expr-mod function treats integers bigger then 2147483647 as negative, resulting in a useless answer. This is a partial solution, it is designed to only handles the range [2147483648, 4294967295].

Test: 2