Ceiling: Difference between revisions
Jump to navigation
Jump to search
m (Text replacement - "<source" to "<syntaxhighlight") |
(Added Reference for Comparison Tolerance) |
||
Line 1: | Line 1: | ||
{{Built-in|Ceiling|⌈}} is a [[monadic]] [[scalar function]] that gives the [[wikipedia:floor and ceiling functions|ceiling]] of a real number, that is, the least integer [[ | {{Built-in|Ceiling|⌈}} is a [[monadic]] [[scalar function]] that gives the [[wikipedia:floor and ceiling functions|ceiling]] of a real number, that is, the least integer tolerantly<ref>[[Robert Bernecky|Bernecky, Robert]]. [https://www.jsoftware.com/papers/satn23.htm "Comparison Tolerance"]. Sharp APL Technical Notes. 1977-06-10;.</ref> [[greater than or equal to]] the given value. This operation is also known as '''round up'''. Ceiling shares the [[glyph]] <syntaxhighlight lang=apl inline>⌈</syntaxhighlight> with the dyadic arithmetic function [[Maximum]]. [[Comparison_with_traditional_mathematics#Prefix|Traditional mathematics]] derives [[Ken_Iverson#Floor_and_Ceiling|its notation]] and name for ceiling from APL. | ||
== Examples == | == Examples == | ||
Line 43: | Line 43: | ||
== External links == | == External links == | ||
== References == | |||
<references /> | |||
=== Documentation === | === Documentation === |
Revision as of 16:00, 28 November 2022
⌈
|
Ceiling (⌈
) is a monadic scalar function that gives the ceiling of a real number, that is, the least integer tolerantly[1] greater than or equal to the given value. This operation is also known as round up. Ceiling shares the glyph ⌈
with the dyadic arithmetic function Maximum. Traditional mathematics derives its notation and name for ceiling from APL.
Examples
Ceiling rounds up the given numbers to the nearest integers.
⌈2 2.8 ¯2 ¯2.8 2 3 ¯2 ¯2
Properties
The ceiling of any real number is an integer.
Ceiling is affected by comparison tolerance. If the given number is tolerantly equal to its floor, it is rounded to that number instead.
⎕PP←16 ⎕←v←1+0.6×⎕CT×0 1 2 1 1.000000000000006 1.000000000000012 ⌈v 1 1 2
Ceiling is the dual to Floor by negation.
v←2 2.8 ¯2 ¯2.8 (⌈v)≡-⌊-v 1
The extension for complex numbers is derived from complex Floor via this property.
v←1.8J2.5 2.5J2.2 1.7J2.2 ⌈v 2J3 3J2 2J2 (⌈v)≡-⌊-v 1
Works in: Dyalog APL
External links
References
- ↑ Bernecky, Robert. "Comparison Tolerance". Sharp APL Technical Notes. 1977-06-10;.