Returns the size of an ulp of the argument

ReturnMethodSummary
static doubleulp(double d)Returns the size of an ulp of the argument.
static floatulp(float f)Returns the size of an ulp of the argument.

public class Main {
  public static void main(String[] args) {

    System.out.println(Math.ulp(1.2));
    System.out.println(Math.ulp(-1.2));
  }
}

The output:


2.220446049250313E-16
2.220446049250313E-16
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.