Choose where you’d like to start

signum

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();
(or)
<variable> = signum(<number>);

where,

ParameterData typeDescription
<variable>DECIMALVariable that will hold the output value.
<number>DECIMAL/ NUMBERVariable 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

Get Started Now

Execute