Template:Floor: Difference between revisions

From Vigyanwiki
Template>Dbenbenn
(Implements the floor function.)
 
Template>Verdy p
m (there's a bug for negative numbers, correcting and testing)
Line 1: Line 1:
<includeonly>{{#expr: ({{{1}}} - 0.5) round 0}}</includeonly><noinclude>
<includeonly>{{#ifexpr:{{{1}}}=({{{1}}} round 0)|{{#expr:
  {{{1}}}+0
}}|{{#expr:
  ({{{1}}} - 0.5) round 0
}}</includeonly><noinclude>
Implements the [[floor function]].
Implements the [[floor function]].


Line 6: Line 10:
Examples:
Examples:
* <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.1}}</nowiki> = {{floor|3.1}}.
* <nowiki>{{floor|3.0}}</nowiki> = {{floor|3.0}}.
* <nowiki>{{floor|1.0}}</nowiki> = {{floor|1.0}}.
* <nowiki>{{floor|0.9}}</nowiki> = {{floor|0.9}}.
* <nowiki>{{floor|0.5}}</nowiki> = {{floor|0.5}}.
* <nowiki>{{floor|0.1}}</nowiki> = {{floor|0.1}}.
* <nowiki>{{floor|0.0}}</nowiki> = {{floor|0.0}}.
* <nowiki>{{floor|-0.1}}</nowiki> = {{floor|-0.1}}.
* <nowiki>{{floor|-0.5}}</nowiki> = {{floor|-0.5}}.
* <nowiki>{{floor|-0.9}}</nowiki> = {{floor|-0.9}}.
* <nowiki>{{floor|-1.0}}</nowiki> = {{floor|-1.0}}.
* <nowiki>{{floor|-3.0}}</nowiki> = {{floor|-3.0}}.
* <nowiki>{{floor|-3.2}}</nowiki> = {{floor|-3.2}}.
* <nowiki>{{floor|-3.5}}</nowiki> = {{floor|-3.5}}.
* <nowiki>{{floor|-3.9}}</nowiki> = {{floor|-3.9}}.
* <nowiki>{{floor|-3.9}}</nowiki> = {{floor|-3.9}}.
* <nowiki>{{floor|-3.2}}</nowiki> = {{floor|-3.2}}.


[[Category:Templates using ParserFunctions]]
[[Category:Templates using ParserFunctions]]
[[Category:Mathematical templates]]
[[Category:Mathematical templates]]
</noinclude>
</noinclude>

Revision as of 19:10, 24 April 2006

Implements the floor function.

Usage: {{floor|<value>}}.

Examples:

  • {{floor|3.9}} = {{#ifexpr:3.9=(3.9 round 0)|3.9|3.
  • {{floor|3.5}} = {{#ifexpr:3.5=(3.5 round 0)|3.5|3.
  • {{floor|3.1}} = {{#ifexpr:3.1=(3.1 round 0)|3.1|3.
  • {{floor|3.0}} = {{#ifexpr:3.0=(3.0 round 0)|3|3.
  • {{floor|1.0}} = {{#ifexpr:1.0=(1.0 round 0)|1|1.
  • {{floor|0.9}} = {{#ifexpr:0.9=(0.9 round 0)|0.9|0.
  • {{floor|0.5}} = {{#ifexpr:0.5=(0.5 round 0)|0.5|0.
  • {{floor|0.1}} = {{#ifexpr:0.1=(0.1 round 0)|0.1|-0.
  • {{floor|0.0}} = {{#ifexpr:0.0=(0.0 round 0)|0|-1.
  • {{floor|-0.1}} = {{#ifexpr:-0.1=(-0.1 round 0)|-0.1|-1.
  • {{floor|-0.5}} = {{#ifexpr:-0.5=(-0.5 round 0)|-0.5|-1.
  • {{floor|-0.9}} = {{#ifexpr:-0.9=(-0.9 round 0)|-0.9|-1.
  • {{floor|-1.0}} = {{#ifexpr:-1.0=(-1.0 round 0)|-1|-2.
  • {{floor|-3.0}} = {{#ifexpr:-3.0=(-3.0 round 0)|-3|-4.
  • {{floor|-3.2}} = {{#ifexpr:-3.2=(-3.2 round 0)|-3.2|-4.
  • {{floor|-3.5}} = {{#ifexpr:-3.5=(-3.5 round 0)|-3.5|-4.
  • {{floor|-3.9}} = {{#ifexpr:-3.9=(-3.9 round 0)|-3.9|-4.