routine floor
1 | class Complex |
1.1 | (Complex) method floor |
2 | role Real |
2.1 | (Real) method floor |
3 | role Rational |
3.1 | (Rational) method floor |
4 | class Cool |
4.1 | (Cool) routine floor |
Documentation for routine floor
assembled from the following types:
class Complex
From Complex
(Complex) method floor
Defined as:
method floor(Complex: --> Complex)
Returns self.re.floor + self.im.floor
. That is, each of the real and imaginary parts is rounded to the highest integer not greater than the value of that part.
say (1.2-3.8i).floor; # OUTPUT: «1-4i»
role Real
From Real
(Real) method floor
method floor(Real --> Int)
Return the largest integer not greater than the number.
role Rational
From Rational
(Rational) method floor
Defined as:
method floor(Rational: --> Int)
Return the largest integer not greater than the invocant. If denominator is zero, fails with X::Numeric::DivideByZero
.
class Cool
From Cool
(Cool) routine floor
Defined as:
multi sub floor(Numeric(Cool))multi method floor
Coerces the invocant (or in sub form, its argument) to Numeric, and rounds it downwards to the nearest integer.
say "1.99".floor; # OUTPUT: «1»say "-1.9".floor; # OUTPUT: «-2»say 0.floor; # OUTPUT: «0»