sign
ErrorsCollection

sign

Synthesised documentation from type/Real type/Cool

From type/Real

See Original text in context

method sign(Real:D:)

Returns -1 if the number is negative, 0 if it is zero and 1 otherwise.

From type/Cool

See Original text in context

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