Template:Modulo/doc
| This is a documentation subpage for Template:Modulo. It may contain usage information, categories and other content that is not part of the original template page. |
| This template is used on approximately 8,000 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
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). This template is not the same as the mod operator in the #expr parser function, which first truncates both operands to an integer before calculating the remainder.
This template can be substituted.
- Usage:
{{mod|dividend|modulus}}- Computes the modulo dynamically.
{{subst:mod|dividend|modulus}}- 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}}= -9.9.{{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
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.