![]() |
VOOZH | about |
The ulp(double num) is an inbuilt method of StrictMath class in java which is used to get the size of an ulp of the given argument. An ulp of a double value is the positive distance between this floating point value and the double value which is next larger in magnitude.
Some special cases are:
Syntax:
public static double ulp(double num)
Parameters: The method accepts one parameter num of double type the floating-point value whose ulp is to be returned.
Return Value: The ulp method returns the size of an ulp of the argument.
Examples:
Input: num = 5.7 Output: 8.881784197001252E-16 Input: num = 0.0 Output: 4.9E-324
Below program illustrates the java.lang.StrictMath.ulp() method:
Program 1:
The Size of ulp of 9.7 = 1.7763568394002505E-15 The Size of ulp of 4.9 = 8.881784197001252E-16
The ulp(float num) is an inbuilt method of StrictMath class in java which is used to get the size of an ulp of the given argument. An ulp of a float value is the positive distance between this floating point value and the float value which is next larger in magnitude.
Some special cases are:
Syntax:
public static float ulp(float num)
Parameters: The method accepts one parameter num of float type the floating-point value whose ulp is to be returned.
Return Value: The ulp method returns the size of an ulp of the argument.
Examples:
Input: num = 5.7 Output: 8.881784197001252E-16 Input: num = 0.0 Output: 4.9E-324
Below program illustrates the java.lang.StrictMath.ulp() method:
Program 1:
The Size of ulp of 2.7 = 2.3841858E-7 The Size of ulp of -4.5 = 4.7683716E-7