Edge Rewrite
// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a23e3995cd3f6bf7

Jump to content

Template talk:Modulo

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia
Latest comment: 14 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