Java StrictMath.ulp(float f)

Syntax

StrictMath.ulp(float f) has the following syntax.

public static float ulp(float f)

Example

In the following code shows how to use StrictMath.ulp(float f) method.


//  w  w w  .j  ava2 s .c  o  m

public class Main {

  public static void main(String[] args) {
  
    float f1 = 1.23f , f2 = -4.3f, f3 = 0.0f;

    System.out.println("Size of ulp of " + f1 + " : " + StrictMath.ulp(f1));
        
    System.out.println("Size of ulp of " + f2 + " : " + StrictMath.ulp(f2));
        
    System.out.println("Size of ulp of " + f3 + " : " + StrictMath.ulp(f3));
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable