Jump to content

Template:Mod/doc: Difference between revisions

From LabVIEW Wiki
New page: <noinclude> :''This is the documentation of Template:Mod.''</noinclude> Implements the mathematical modulo operator. The returned result is always of the same sign as the ''modulus...
 
m Add <noinclude> tags for {{documentation subpage}}
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<noinclude>
<noinclude>{{documentation subpage}}</noinclude>
:''This is the documentation of [[Template:Mod]].''</noinclude>
Implements the mathematical [[modulo]] operator. The returned result is always of the same sign as the ''modulus'' or nul, and its absolute value is lower than the absolute value of the ''modulus''. However, this template returns 0 if the ''modulus'' is nul (this template should never return a division by zero error).
Implements the mathematical [[modulo]] operator. The returned result is always of the same sign as the ''modulus'' or nul, and its absolute value is lower than the absolute value of the ''modulus''. However, this template returns 0 if the ''modulus'' is nul (this template should never return a division by zero error).


Line 60: Line 59:


; See also<nowiki>:</nowiki>
; See also<nowiki>:</nowiki>
* [[Template:Floor]]
<includeonly>
<includeonly>
[[Category:Templates using ParserFunctions|{{PAGENAME}}]]
[[Category:Templates using ParserFunctions|{{PAGENAME}}]]
[[Category:Mathematical function templates|{{PAGENAME}}]]
[[Category:Mathematical function templates|{{PAGENAME}}]]
[[id:Templat:Mod]]
[[nl:Sjabloon:Mod]]
[[fi:Malline:Mod]]
</includeonly>
</includeonly>

Latest revision as of 16:23, 1 August 2024

This is the documentation page for Template:Mod.
When it is viewed directly, links using variables may appear broken; do not replace these with hardcoded page names or URLs.

Implements the mathematical modulo operator. The returned result is always of the same sign as the modulus or nul, and its absolute value is lower than the absolute value of the modulus. However, this template returns 0 if the modulus is nul (this template should never return a division by zero error).

Usage:
{{mod|dividend|modulus}}
Computes the modulo dynamically.
{{subst:mod|dividend|modulus|subst=subst:}}
Substitute the template invokation by its computed value when saving an article Wiki source.
Examples with positive integer modulus:
  • {{mod|12|10}} = 2.
  • {{mod|10.1|10}} = 0.1.
  • {{mod|10|10}} = 0.
  • {{mod|2|10}} = 2.
  • {{mod|0|10}} = 0.
  • {{mod|-2|10}} = 8.
  • {{mod|-10|10}} = 0.
  • {{mod|-10.1|10}} = 9.9.
  • {{mod|-12|10}} = 8.
Examples with negative integer modulus:
  • {{mod|12|-10}} = -8.
  • {{mod|10.1|-10}} = 0.1.
  • {{mod|10|-10}} = 0.
  • {{mod|2|-10}} = -8.
  • {{mod|0|-10}} = 0.
  • {{mod|-2|-10}} = -2.
  • {{mod|-10|-10}} = 0.
  • {{mod|-10.1|-10}} = -0.1.
  • {{mod|-12|-10}} = -2.
Examples with positive non integer modulus:
  • {{mod|21.5|10.5}} = 0.5.
  • {{mod|21.1|10.5}} = 0.1.
  • {{mod|21|10.5}} = 0.
  • {{mod|20.9|10.5}} = 10.4.
  • {{mod|11|10.5}} = 0.5.
  • {{mod|10.6|10.5}} = 0.1.
  • {{mod|10.5|10.5}} = 0.
  • {{mod|10.1|10.5}} = 10.1.
  • {{mod|10|10.5}} = 10.
  • {{mod|2|10.5}} = 2.
  • {{mod|0|10.5}} = 0.
  • {{mod|-2|10.5}} = 8.5.
  • {{mod|-10|10.5}} = 0.5.
  • {{mod|-10.1|10.5}} = 0.4.
  • {{mod|-10.5|10.5}} = 0.
  • {{mod|-10.6|10.5}} = 10.4.
  • {{mod|-11|10.5}} = 10.
  • {{mod|-20.9|10.5}} = 0.1.
  • {{mod|-21|10.5}} = 0.
  • {{mod|-21.1|10.5}} = 10.4.
  • {{mod|-21.5|10.5}} = 10.
Examples with nul modulus:
  • {{mod|2|0}} = 0.
  • {{mod|0|0}} = 0.
  • {{mod|-2|0}} = 0.
See also: