StrictMath.ulp(double): This method is available in java.lang.StrictMath class of Java.
Syntax:
double java.lang.StrictMath.ulp(double d)
This method takes one argument of type double as its parameter. This method returns the size of an ulp of the argument.
Note:
1. If the argument is NaN, then the result is NaN.
2. If the argument is positive or negative infinity, then the result is positive infinity.
3. If the argument is positive or negative zero, then the result is Double.MIN_VALUE.
4. If the argument is ±Double.MAX_VALUE, then the result is equal to 2971.
Parameters: One parameter is required for this method.
d: the floating-point value whose ulp is to be returned.
Returns: the size of an ulp of the argument.
Exceptions: NA
Approach
Java
public class StrictMathulpdouble {public static void main(String[] args) {double d = 167;System.out.println(StrictMath.ulp(d));}}
Output:
2.8421709430404007E-14
No comments:
Post a Comment