method sign
1 | role Real |
1.1 | (Real) method sign |
2 | class Cool |
2.1 | (Cool) method sign |
Documentation for method sign
assembled from the following types:
role Real
From Real
(Real) method sign
method sign(Real:)
Returns -1
if the number is negative, 0
if it is zero and 1
otherwise.
class Cool
From Cool
(Cool) method sign
Defined as:
method sign()
Coerces the invocant to Numeric and returns its sign, that is, 0 if the number is 0, 1 for positive and -1 for negative values.
say 6.sign; # OUTPUT: «1»say (-6).sign; # OUTPUT: «-1»say "0".sign; # OUTPUT: «0»