Template talk:Modulo

Latest comment: 13 years ago by Jimp

Difference from 'mod' expression

edit

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)Reply

We should explain this in the doc rather than just stating that these are different (as the doc does now). JIMp talk·cont 01:40, 14 September 2011 (UTC)Reply