90
Java Math.signum() method
The java.lang.Math.signum () is used to find the sign of a given value.
Syntax
Parameter
Return
- If the argument is positive or negative Zero, this method will return Zero.
- If the argument is positive value, this method will return Positive 1.
- If the argument is Negative value, this method will return Negative 1.
- If the argument is NaN, this method will return NaN.
Example 1
Output:
1.0
Example 2
Output:
-1.0
Example 3
Output:
0.0
Example 4
Output:
NaN
Next TopicJava Math