Skip to main content

⌈ — Ceiling / Maximum

Function. Keys: Alt-s. Hanzi: 上. Ranks: 0 monadic, 0 0 dyadic

⌈Y rounds real numbers up. Pervasive; tolerant near integers. Under dynamic kinds, real float results become ordinary machine integers. Under static kinds they remain floats. ⌈ₓY gives ordinary machine integers in both modes. Exact-domain inputs stay exact.

Integer-producing real forms clamp to the selected integer range: positive infinity gives its maximum, negative infinity its minimum, and NaN gives zero. See Static kinds for the integer width.

Complex ceiling is -⌊-Y, using complex floor’s Gaussian-integer rule.

⌈1.2 ¯1.2         ⍝ [2 ¯1]ₓ
⌈3r2              ⍝ 2ᵣ

X⌈Y takes the real maximum, and for characters the one with the higher code point. A character is greater than any number, as ⍋ orders them. Pervasive. Beside NaN it gives NaN or the other argument. Which one can vary by platform. A reduction, scan, window or inner product by ⌈, or a write by ⌈← to one position more than once, gives NaN or the greatest of the items that aren’t NaN, ¯∞ where there are none, and never another number. Empty reduction identity: ¯∞.

3⌈1 5             ⍝ 3 5
"abc"⌈"bab"       ⍝ "bbc"
3⌈'a'             ⍝ 'a'