Java StrictMath.ulp(double d)

Syntax

StrictMath.ulp(double d) has the following syntax.

public static double ulp(double d)

Example

In the following code shows how to use StrictMath.ulp(double d) method.


//  w w  w.  jav  a  2  s . c om
public class Main {

  public static void main(String[] args) {
  
    double d1 = 1.2 , d2 = -2.3, d3 = 0.0;
  
    System.out.println("Size of ulp of " + d1 + " = " + StrictMath.ulp(d1));
    
    System.out.println("Size of ulp of " + d2 + " = " + StrictMath.ulp(d2));
    
    System.out.println("Size of ulp of " + d3 + " = " + StrictMath.ulp(d3));
 }
}

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