public class exampleAP2{ public static void main(String arg[]){ double tenth=0.1, half=0.5, r1, r2; float fr=(float)5.6875; System.out.print(" fr =\t" + fr +"\t: "); System.out.println( Integer.toHexString(Float.floatToIntBits(fr))); r1 = 1.0 - half -half; System.out.print(" 0.5 =\t" + half +"\t: "); System.out.println( Long.toHexString(Double.doubleToLongBits(half))); System.out.println(" 1 - 0.5 - 0.5 =\t" + r1); r2 = 1.0 - tenth - tenth - tenth - tenth - tenth - tenth - tenth - tenth - tenth - tenth; System.out.print(" 0.1 =\t" + tenth +"\t: "); System.out.println( Long.toHexString(Double.doubleToLongBits(tenth))); System.out.println(" 1 - 0.1 - 0.1 ..=\t" + r2); } }