signum Summary Returns a value indicating the sign for a number. Signatures Click on a signature to select it and view its documentation. public static int signum(int x) public static int signum(double x) Usage public static int signum(int x) public static int signum(double x) Returns 0 if the argument is 0, 1 if the argument is greater than 0, and -1 if the argument is less than 0. 0 if the argument is 0, 1 if the argument is greater than 0, and -1 if the argument is less than 0. Parameters x The number to extract the sign from. Parameters x The number to extract the sign from. Description Returns a value indicating the sign for a number. 0 if the argument is 0, 1 if the argument is positive (greater than 0), and -1 if the argument is negative (less than 0). Returns a value indicating the sign for a number. 0 if the argument is 0, 1 if the argument is positive (greater than 0), and -1 if the argument is negative (less than 0). Examples Basic Usage 12345import System; Console.log(Math.signum(-100)); // -1, negative numberConsole.log(Math.signum(0)); // 0, zero valueConsole.log(Math.signum(50)); // 1, positive number Basic Usage 12345import System; Console.log(Math.signum(-2.2d)); // -1, negative numberConsole.log(Math.signum(0d)); // 0, zero valueConsole.log(Math.signum(5.1d)); // 1, positive number Share HTML | BBCode | Direct Link