Template talk:Min
Template:Min is permanently protected from editing because it is a heavily used or highly visible template. Substantial changes should first be proposed and discussed here on this page. If the proposal is uncontroversial or has been discussed and is supported by consensus, editors may use {{edit template-protected}} to notify an administrator or template editor to make the requested edit. Usually, any contributor may edit the template's documentation to add usage notes or categories.
Any contributor may edit the template's sandbox. This template does not have a testcases subpage. You can create the testcases subpage here. |
Why full protected?
[edit]There are no records of vandalism. Semi-protection should be sufficient. This stops normal users who want to make changes unable to do so! >.< --Jutiphan 18:14, 24 December 2006 (UTC)
- This template is used on roughly 5% of all articles in Wikipedia, there is no reason that the logic for determining the minimum value would need to be changed frequently (if ever), and 'regular users' can update the documentation, categories, and interwiki links on the documentation sub-page at will. --CBD 14:04, 15 January 2007 (UTC)
Please add th interwiki
[edit]En wiki just love to protect everything.. ~>< Somebody please add interwiki link: th:แม่แบบ:Min Thanks --Jutiphan 01:08, 15 January 2007 (UTC)
- Done. Note that the first line on the template page contains a link to the non protected documentation sub-page where you could have added this yourself. --CBD 13:57, 15 January 2007 (UTC)
Protected template
[edit]{{editprotected}}
Please add {{pp-template|small=yes}}. Thanks. Rocket000 21:27, 16 October 2007 (UTC)
- You can make this change yourself by editing the documentation page, {{min/doc}}. --ais523 10:25, 17 October 2007 (UTC)
edit request
[edit]{{editprotected}}
Can you replace {{Min/doc}} to {{Documentation}} in <noinclude> tag? Thanks. --fryed-peach (talk) 18:41, 13 July 2008 (UTC)
- Done. Cheers. --MZMcBride (talk) 19:05, 13 July 2008 (UTC)
Lua version
[edit]I've created a Lua implementation that allows for arbitrary number of parameters:
- {{#invoke:Math | min | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 }} = 1
If one wants to ensure that expression such as 4*41 and 600+30 are evaluated correctly (as is the current practice), then they need to be wrapped in {{#expr: }}
- {{#invoke:Math | min | {{#expr: 4*41 }} | {{#expr: 600+30 }} }} = 164
So it should be possible to replace the current template with:
- {{#invoke:Math|min| {{#expr:{{{1}}}}} | {{#expr:{{{2}}}}} | {{#expr:{{{3}}}}} }}
Which will duplicate current functionality, or add additional parameters to extend functionality.
Test Cases:
Test | {{min}} | {{min/sandbox}} |
---|---|---|
{{min}} | ||
{{min|}} | ||
{{min|-7}} | -7 | -7 |
{{min|-7|}} | -7 | -7 |
{{min|7|-5}} | -5 | -5 |
{{min|7|-5|}} | -5 | -5 |
{{min|7|-5|-8}} | -8 | -8 |
{{min|40*41|300+30}} | 330 | 330 |
{{min|100+10|300+30|200+20}} | 110 | 110 |
If people know of other edge cases, I would welcome additional testing. Dragons flight (talk) 17:24, 21 February 2013 (UTC)
- I've made a better version that doesn't require the use of #expr:, and can take a practically limitless numbers of arguments:
- {{min/sandbox|-1|-2|-3|-4|-5|-6|-7|-8|-9|-10|-11|-12|-13|-14}} = -14
- Yay to new technology. Dragons flight (talk) 01:42, 22 February 2013 (UTC)
- I went ahead and switched min to the Lua version. Dragons flight (talk) 02:26, 22 February 2013 (UTC)