// Rem.java -- remainder for real numbers too // IEEEremainder f1 - f2*n n is the closest integer // % f1 - f2*n n is the smallest integer class Rem { public static void main (String [] args) { System.out.println (23.7%3.1); // 2.0 System.out.println (Math.IEEEremainder (23.7,3.1)); // -1.1 System.out.println (23.7%3.53); // 2.52 System.out.println (Math.IEEEremainder (23.7,3.53)); // -1.01 System.out.println (23.7%3.9); // 0.3 System.out.println (Math.IEEEremainder (23.7,3.9)); // 0.3 } }