Example usage for java.lang StrictMath ulp

List of usage examples for java.lang StrictMath ulp

Introduction

In this page you can find the example usage for java.lang StrictMath ulp.

Prototype

public static float ulp(float f) 

Source Link

Document

Returns the size of an ulp of the argument.

Usage

From source file:Main.java

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));
}

From source file:Main.java

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));
}