StrictMath.signum(float): This method is available in java.lang.StrictMath class of Java.
Syntax:
float java.lang.StrictMath.signum(float f)
This method takes one argument of type float as its parameter. This method returns the signum function of the argument; zero if the argument is zero, 1.0f if the argument is greater than zero, -1.0f if the argument is less than zero.
Note:
1. If the argument is NaN, then the result is NaN.
2. If the argument is positive zero or negative zero, then the result is the same as the argument.
Parameters: One parameter is required for this method.
f: the floating-point value whose signum is to be returned.
Returns: the signum function of the argument.
Exceptions: NA
Approach
Java
public class StrictMathsignumfloat {public static void main(String[] args) {float f = 16767.56f;System.out.println(StrictMath.signum(f));}}
Output:
1.0
No comments:
Post a Comment