// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
public class DoubleSplit {
   public static void test1(double tal) {
      long del1 = (long)tal;
      short del2 = (short)((tal - del1)*10000);
      System.out.println(del1 + " " + del2);
   }
   public static void test2(double tal) {
      long del1 = (long)tal;
      long del2 = 0;
      double tmp = tal - del1;
      int digit;
      while(tmp > 0.0000001) {
         digit = (int)(tmp * 10);
         del2 = 10 * del2 + digit;
         tmp = 10 * tmp - digit;
      }
      System.out.println(del1 + " " + del2);
   }
   public static void main(String[] args) {
      test1(1234.5678);
      test2(1234.5678);
      test1(1234.567);
      test2(1234.567);
      test1(1234.56789);
      test2(1234.56789);
   }
}
