signum
Table of Contents
Overview
The signum function is used to extract the sign of the given input values. It returns 1.0 if the input decimal is positive, -1.0 if it is negative, and 0.0 if it is 0.
Return Type
Syntax
<variable> = <number>.signum();
<variable> = signum(<number>);
where,
Parameter | Data type | Description |
<variable> | DECIMAL | Variable that will hold the output value. |
<number> | DECIMAL/ NUMBER | Variable that holds the input decimal value. |
Examples
number = 25.125432 ; info number.signum(); // Returns 1.0 number = -12; info signum(number); // Returns -1.0 number = 0 ; info number.signum(); // Returns 0.0