Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.math.BigDecimal;

public class Main {

    public static void main(String[] args) {

        BigDecimal bg1, bg2, bg3, bg4;

        bg1 = new BigDecimal("123");
        bg2 = new BigDecimal("1.23");

        // assign ulp value of bg1, bg2 to bg3, bg4
        bg3 = bg1.ulp();
        bg4 = bg2.ulp();

        System.out.println("ULP value of " + bg1 + " is " + bg3);
        System.out.println("ULP value of " + bg2 + " is " + bg4);
    }
}