sign()
Learn how to use the sign() function to return the sign of the numeric expression.
Returns the sign of the numeric expression.
Syntax
sign(number)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| number | real | ✔️ | The number for which to return the sign. |
Returns
The positive (+1), zero (0), or negative (-1) sign of the specified expression.
Examples
print s1 = sign(-42), s2 = sign(0), s3 = sign(11.2)
Output
| s1 | s2 | s3 |
|---|---|---|
| -1 | 0 | 1 |
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.