`Mathsignum.java`

```
//Returns in double type.
//1 if positive.0, 0 if 0.0, if it is a negative number-1.Returns 0.
System.out.print(Math.signum(10)); // 1.0
System.out.print(Math.signum(0)); // 0.0
System.out.print(Math.signum(-10)); // -1.0
```

The Math class contains methods for performing basic numerical operations such as exponential, logarithmic, square root, and trigonometric functions.

It seems.

Returns the sign element of the argument. Zero if the argument is zero, 1.0 if the argument is greater than zero, -1.0 if the argument is less than zero.

The wording is slightly different, but it is as stated in the comment out above.

Class Math signum method | Introduction to Java code

Recommended Posts