floor
ErrorsCollection

floor

Synthesised documentation from type/Rational type/Real type/Cool type/Complex

From type/Rational

See Original text in context

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

Return the largest integer not greater than the invocant. If denominator is zero, fail with X::Numeric::DivideByZero.

From type/Real

See Original text in context

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

Return the largest integer not greater than the number.

From type/Cool

See Original text in context

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␤»

From type/Complex

See Original text in context

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

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␤»