Template talk:Mod

From Wikipedia, the free encyclopedia

[edit] Difference from 'mod' expression

Why don't use {{#expr: {{{1}}} mod {{{2}}} }}--SunnyChow

The m:ParserFunctions modulus division is very 'non standard' in comparison to how modulus division works in most programming languages and mathematics texts. This template was created to mimic the more usual calculations. Specifically, the #expr will truncate both operands to whole numbers before performing the modulus division while this template uses the un-truncated values. For example;
{{#expr: 7.7 mod 2.5 }} = 1
{{mod|7.7|2.5}} = 0.2

Either can be used for a particular calculation as needed, but the differences in processing needed to be considered. --CBD 12:44, 22 August 2007 (UTC)