Ceiling: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
m (Text replacement - " ⊢( *[^∘])" to " ⎕←$1")
(One intermediate revision by one other user not shown)
Line 46: Line 46:
=== Documentation ===
=== Documentation ===

* [http://help.dyalog.com/latest/#Language/Primitive%20Functions/Ceiling.htm Dyalog]
* [https://help.dyalog.com/latest/#Language/Primitive%20Functions/Ceiling.htm Dyalog]
* [http://microapl.com/apl_help/ch_020_020_090.htm APLX]
* [http://microapl.com/apl_help/ch_020_020_090.htm APLX]
* [https://www.jsoftware.com/help/dictionary/d021.htm J Dictionary], [https://code.jsoftware.com/wiki/Vocabulary/gtdot NuVoc]
* [https://www.jsoftware.com/help/dictionary/d021.htm J Dictionary], [https://code.jsoftware.com/wiki/Vocabulary/gtdot NuVoc]
* [https://mlochbaum.github.io/BQN/doc/arithmetic.html#additional-arithmetic BQN]
{{APL built-ins}}[[Category:Primitive functions]][[Category:Scalar monadic functions]]
{{APL built-ins}}[[Category:Primitive functions]][[Category:Scalar monadic functions]]

Revision as of 02:16, 28 May 2022

Ceiling () is a monadic scalar function that gives the ceiling of a real number, that is, the least integer tolerantly 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.


Ceiling rounds up the given numbers to the nearest integers.

      ⌈2 2.8 ¯2 ¯2.8
2 3 ¯2 ¯2


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.

      ⎕←v←1+0.6×⎕CT×0 1 2
1 1.000000000000006 1.000000000000012
1 1 2

Ceiling is the dual to Floor by negation.

      v←2 2.8 ¯2 ¯2.8

The extension for complex numbers is derived from complex Floor via this property.

      v←1.8J2.5 2.5J2.2 1.7J2.2
2J3 3J2 2J2
Works in: Dyalog APL

External links


APL built-ins [edit]
Primitive functions
Monadic ConjugateNegateSignumReciprocalMagnitudeExponentialNatural LogarithmFloorCeilingFactorialNotPi TimesRollTypeImaginarySquare Root
Dyadic AddSubtractTimesDivideResiduePowerLogarithmMinimumMaximumBinomialComparison functionsBoolean functions (And, Or, Nand, Nor) ∙ GCDLCMCircularComplexRoot
Structural ShapeReshapeTallyDepthRavelEnlistTableCatenateReverseRotateTransposeRazeMixSplitEncloseNestCut (K)PairLinkPartitioned EnclosePartition
Selection FirstPickTakeDropUniqueIdentitySelectReplicateExpandSet functions (IntersectionUnionWithout) ∙ Bracket indexingIndex
Selector Index generatorGradeIndex OfInterval IndexIndicesDeal
Computational MatchNot MatchMembershipFindNub SieveEncodeDecodeMatrix InverseMatrix DivideFormatExecuteMaterialiseRange
Primitive operators Monadic EachCommuteConstantReplicateExpandReduceWindowed ReduceScanOuter ProductKeyI-BeamSpawnFunction axis
Dyadic BindCompositions (Compose, Reverse Compose, Beside, Withe, Atop, Over) ∙ Inner ProductPowerAtUnderRankDepthVariantStencilCut (J)
Quad names
Arrays Index originMigration levelAtomic vector
Functions Name classCase convertUnicode convert
Operators SearchReplace