Template:Floor: Difference between revisions
From Vigyanwiki
Template>Verdy p m (there's another bug for positive numbers near 0, correcting and testing) |
Template>Verdy p m (better documentation) |
||
Line 1: | Line 1: | ||
<includeonly>{{#ifexpr:({{{1}}})=(({{{1}}})round 0)|{{#expr:({{{1}}})+0}}|{{#ifexpr:({{{1}}})>0 and ({{{1}}})<1|0|{{#expr:(({{{1}}})-0.5)round 0}}}}}}</includeonly><noinclude> | <includeonly>{{#ifexpr:({{{1}}})=(({{{1}}})round 0)|{{#expr:({{{1}}})+0}}|{{#ifexpr:({{{1}}})>0 and ({{{1}}})<1|0|{{#expr:(({{{1}}})-0.5)round 0}}}}}}</includeonly><noinclude>{{Template documentation}} | ||
Implements the [[floor function]]. | Implements the mathematical [[floor function]]. | ||
Usage: <nowiki>{{floor|<value>}}</nowiki> | ; Usage<nowiki>:</nowiki> | ||
: <tt><nowiki>{{</nowiki>floor|</tt>''value''<tt><nowiki>}}</nowiki></tt> | |||
Examples: | ; Examples<nowiki>:</nowiki> | ||
* <nowiki>{{floor|3.9}}</nowiki> = {{floor|3.9}}. | * <nowiki>{{floor|3.9}}</nowiki> = {{floor|3.9}}. | ||
* <nowiki>{{floor|3.5}}</nowiki> = {{floor|3.5}}. | * <nowiki>{{floor|3.5}}</nowiki> = {{floor|3.5}}. |
Revision as of 19:22, 24 April 2006
Template:Template documentation Implements the mathematical floor function.
- Usage:
- {{floor|value}}
- Examples:
- {{floor|3.9}} = 3.
- {{floor|3.5}} = 3.
- {{floor|3.1}} = 3.
- {{floor|3.0}} = 3.
- {{floor|1.0}} = 1.
- {{floor|0.9}} = 0.
- {{floor|0.5}} = 0.
- {{floor|0.1}} = 0.
- {{floor|0.0}} = 0.
- {{floor|-0.1}} = -1.
- {{floor|-0.5}} = -1.
- {{floor|-0.9}} = -1.
- {{floor|-1.0}} = -1.
- {{floor|-3.0}} = -3.
- {{floor|-3.2}} = -4.
- {{floor|-3.5}} = -4.
- {{floor|-3.9}} = -4.