Math.ulp(float f) has the following syntax.
public static float ulp(float f)
In the following code shows how to use Math.ulp(float f) method.
//from www .j av a 2 s. c om public class Main { public static void main(String[] args) { // get two double float numbers float x = 123.456f; float y = 123.1f; // print the ulp of these floats System.out.println("Math.ulp(" + x + ")=" + Math.ulp(x)); System.out.println("Math.ulp(" + y + ")=" + Math.ulp(y)); } }
The code above generates the following result.