Difference between revisions of "Template:Mod"
Jump to navigation
Jump to search
m |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
<includeonly>{{#expr:{{#ifexpr:({{{1|0}}}) >= 2147483648|((({{{1}}} - 2147483648) mod {{{2}}}) - ((-2147483648) mod {{{2}}})) mod {{{2}}}|(({{{1}}}) mod {{{2}}})}}}}</includeonly><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}} | Test: {{{{PAGENAME}}|2147483690|23}} | ||
</noinclude> | </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