routine ceiling

Documentation for routine ceiling assembled from the following types:

class Complex

From Complex

(Complex) method ceiling

Defined as:

method ceiling(Complex:D: --> Complex:D)

Returns self.re.ceiling + self.im.ceiling. That is, each of the real and imaginary parts is rounded to the lowest integer not less than the value of that part.

say (1.2-3.8i).ceiling;         # OUTPUT: «2-3i␤»

role Real

From Real

(Real) method ceiling

method ceiling(Real:D --> Int:D)

Returns the smallest integer not less than the number.

role Rational

From Rational

(Rational) method ceiling

Defined as:

method ceiling(Rational:D: --> Int:D)

Return the smallest integer not less than the invocant. If denominator is zero, fails with X::Numeric::DivideByZero.

class Cool

From Cool

(Cool) routine ceiling

Defined as:

multi sub ceiling(Numeric(Cool))
multi method ceiling

Coerces the invocant (or in sub form, its argument) to Numeric, and rounds it upwards to the nearest integer.

say "1".ceiling;        # OUTPUT: «1␤» 
say "-0.9".ceiling;     # OUTPUT: «0␤» 
say "42.1".ceiling;     # OUTPUT: «43␤»