Template:Ceil: Difference between revisions

From Vigyanwiki
Template>Verdy p
mNo edit summary
Template>Verdy p
mNo edit summary
Line 1: Line 1:
<includeonly>{{#ifexpr:({{{1}}})=(({{{1}}})round 0)|{{#expr:{{{1}}}}}|{{#ifexpr:({{{1}}})>0|{{#expr:((({{{1}}})+0.5)round 0)}}|{{#expr:1-((0.5-({{{1}}}))round 0)}}}}}}</includeonly><noinclude>{{Template documentation}}
<includeonly>{{#ifexpr:({{{1}}})=(({{{1}}})round 0)|{{#expr:{{{1}}}}}|{{#ifexpr:({{{1}}})>0|{{#expr:((({{{1}}})+0.5)round 0)}}|{{#expr:1-((0.5-({{{1}}}))round 0)}}}}}}</includeonly><noinclude>{{Template documentation}}
Implements the mathematical [[ceil function]].
Implements the mathematical [[ceil function]], i.e. returns the input value if it’s an integer, otherwise returns the lowest integer which is still greater than the input value.
 
For positive numbers, it will truncate the displayed decimals. For negative numbers, the decimals will be dropped, but the integer part of the absolute value displayed is decremented. This is the mathemetical definition of the IEEE rounding mode toward minus infinite.


; Usage<nowiki>:</nowiki>
; Usage<nowiki>:</nowiki>

Revision as of 12:23, 3 May 2006

Template:Template documentation Implements the mathematical ceil function, i.e. returns the input value if it’s an integer, otherwise returns the lowest integer which is still greater than the input value.

For positive numbers, it will truncate the displayed decimals. For negative numbers, the decimals will be dropped, but the integer part of the absolute value displayed is decremented. This is the mathemetical definition of the IEEE rounding mode toward minus infinite.

Usage:
{{Ceil|value}}
Examples:
  • {{Ceil|3.9}} = 4.
  • {{Ceil|3.5}} = 4.
  • {{Ceil|3.1}} = 4.
  • {{Ceil|3.0}} = 3.
  • {{Ceil|1.0}} = 1.
  • {{Ceil|0.9}} = 1.
  • {{Ceil|0.5}} = 1.
  • {{Ceil|0.1}} = 1.
  • {{Ceil|0.0}} = 0.
  • {{Ceil|-0.1}} = 0.
  • {{Ceil|-0.5}} = 0.
  • {{Ceil|-0.9}} = 0.
  • {{Ceil|-1.0}} = -1.
  • {{Ceil|-3.0}} = -3.
  • {{Ceil|-3.2}} = -3.
  • {{Ceil|-3.5}} = -3.
  • {{Ceil|-3.9}} = -3.
See also: