Template:Ceil: Difference between revisions

From Vigyanwiki
Template>Erik Baas
m (+nl:)
m (39 revisions imported from alpha:Template:Ceil)
 
(31 intermediate revisions by 24 users not shown)
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}}
{{{1}}}<noinclude>{{Documentation|content=
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.
== Description ==
Displays the parameter wrapped in ceiling symbols. This template is for display, not calculation.


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 mathematical definition of the IEEE rounding mode ''toward minus infinite''.
== Examples ==
{{demo|<nowiki>{{Ceil|45.23}}</nowiki>}}
{{demo|<nowiki>{{Ceil|''x''}}</nowiki>}}


; Usage<nowiki>:</nowiki>
== See also ==
: <tt><nowiki>{{</nowiki>{{PAGENAME}}|</tt>''value''<tt><nowiki>}}</nowiki></tt>
{{Math templates|notation}}


; Examples<nowiki>:</nowiki>
[[Category:Mathematical formatting templates]]
* <tt><nowiki>{{</nowiki>{{PAGENAME}}<nowiki>|</nowiki>3.9<nowiki>}}</nowiki></tt> = {{{{PAGENAME}}|3.9}}.
}}</noinclude>
* <tt><nowiki>{{</nowiki>{{PAGENAME}}<nowiki>|</nowiki>3.5<nowiki>}}</nowiki></tt> = {{{{PAGENAME}}|3.5}}.
* <tt><nowiki>{{</nowiki>{{PAGENAME}}<nowiki>|</nowiki>3.1<nowiki>}}</nowiki></tt> = {{{{PAGENAME}}|3.1}}.
* <tt><nowiki>{{</nowiki>{{PAGENAME}}<nowiki>|</nowiki>3.0<nowiki>}}</nowiki></tt> = {{{{PAGENAME}}|3.0}}.
* <tt><nowiki>{{</nowiki>{{PAGENAME}}<nowiki>|</nowiki>1.0<nowiki>}}</nowiki></tt> = {{{{PAGENAME}}|1.0}}.
* <tt><nowiki>{{</nowiki>{{PAGENAME}}<nowiki>|</nowiki>0.9<nowiki>}}</nowiki></tt> = {{{{PAGENAME}}|0.9}}.
* <tt><nowiki>{{</nowiki>{{PAGENAME}}<nowiki>|</nowiki>0.5<nowiki>}}</nowiki></tt> = {{{{PAGENAME}}|0.5}}.
* <tt><nowiki>{{</nowiki>{{PAGENAME}}<nowiki>|</nowiki>0.1<nowiki>}}</nowiki></tt> = {{{{PAGENAME}}|0.1}}.
* <tt><nowiki>{{</nowiki>{{PAGENAME}}<nowiki>|</nowiki>0.0<nowiki>}}</nowiki></tt> = {{{{PAGENAME}}|0.0}}.
* <tt><nowiki>{{</nowiki>{{PAGENAME}}<nowiki>|</nowiki>-0.1<nowiki>}}</nowiki></tt> = {{{{PAGENAME}}|-0.1}}.
* <tt><nowiki>{{</nowiki>{{PAGENAME}}<nowiki>|</nowiki>-0.5<nowiki>}}</nowiki></tt> = {{{{PAGENAME}}|-0.5}}.
* <tt><nowiki>{{</nowiki>{{PAGENAME}}<nowiki>|</nowiki>-0.9<nowiki>}}</nowiki></tt> = {{{{PAGENAME}}|-0.9}}.
* <tt><nowiki>{{</nowiki>{{PAGENAME}}<nowiki>|</nowiki>-1.0<nowiki>}}</nowiki></tt> = {{{{PAGENAME}}|-1.0}}.
* <tt><nowiki>{{</nowiki>{{PAGENAME}}<nowiki>|</nowiki>-3.0<nowiki>}}</nowiki></tt> = {{{{PAGENAME}}|-3.0}}.
* <tt><nowiki>{{</nowiki>{{PAGENAME}}<nowiki>|</nowiki>-3.2<nowiki>}}</nowiki></tt> = {{{{PAGENAME}}|-3.2}}.
* <tt><nowiki>{{</nowiki>{{PAGENAME}}<nowiki>|</nowiki>-3.5<nowiki>}}</nowiki></tt> = {{{{PAGENAME}}|-3.5}}.
* <tt><nowiki>{{</nowiki>{{PAGENAME}}<nowiki>|</nowiki>-3.9<nowiki>}}</nowiki></tt> = {{{{PAGENAME}}|-3.9}}.
 
; See also<nowiki>:</nowiki>
* [[Template:Floor]]
 
[[Category:Templates using ParserFunctions|{{PAGENAME}}]]
[[Category:Mathematical templates|{{PAGENAME}}]]
 
[[fr:Modèle:Ceil]]
[[nl:Sjabloon:Ceil]]
</noinclude>

Latest revision as of 11:35, 27 July 2023

⌈{{{1}}}⌉

Template documentation

Description

Displays the parameter wrapped in ceiling symbols. This template is for display, not calculation.

Examples

Template:Demo Template:Demo

See also

[[Category:Template documentation pages{{#translation:}}]]