 }
 
 void displayNumber() {
-  //turn on the LEDs accoring to the number from 0-9
-  int dispNum=num[refreshLoop];
-
-  if (dispNum == -1)
-    clearLEDs();
-  else
-    updateShiftRegister(numbers[dispNum]);
-}
-
-void splitNumber(int n) {
-  //takes the input n and puts into the array num, split in ones, tens, hundreds, and thousands place
-  
-  //clear previous values of the num array, -1 value allows checking to see if a new value has been placed
-  for (int i=1; i<4; i++)
-    num[i] = -1;
+  //turn on the LEDs accoring to the number stored in array num on the refresh cycle
+  updateShiftRegister(num[refreshLoop]);
+}
+
+void splitNumber(double n) {
+  //takes the input n and puts into the array num, split into 4 digits from lsb to msb
+  double decimalPart = 0.0;
+  int wholePart = 0;
+
+  //clear previous values of the num array
+  for (int i=0; i<4; i++)
+  {
+    num[i] = off;
+    negative = false;
+  }
+
+  if (n < 0) {
+    n = abs(n);
+    negative = true;
+  }
+
+  decimalPart = fmod(n,1.0);
+  wholePart = n - decimalPart;
+
+  int splitPosition = splitWhole(wholePart);
+
+  if(negative)
+    num[splitPosition] = minus;
+}
+
+int splitWhole(int n) {
+  //takes the input n and puts into the array num, and return the array position
+  int whole[] = {-1,-1,-1,-1, -1};
+  int wholePosition = 0;
+  int j=0;
+
+  if (negative){
+    if (n > 999) {
+      n = 0;
+      negative = false;
+    }
+    else
+      j = 1;
+  }
 
   //if n is 0-9
   if (n < 10) {
-    num[0] = n;
+    whole[0+j] = n;
   }
   //else if n is 10-99
   else if (n < 100) {
-    num[1] = n / 10;
-    num[0] = n % 10;
+    whole[1+j] = n / 10;
+    whole[0+j] = n % 10;
   }
   //else if n is 100-999
   else if (n < 1000) {
-    num[2] = n / 100;
+    whole[2+j] = n / 100;
     n = n % 100;
-    num[1] = n / 10;
-    num[0] = n % 10;
+    whole[1+j] = n / 10;
+    whole[0+j] = n % 10;
   }
   //else if n is 1000-9999
   else if (n < 10000) {
-    num[3] = n / 1000;
+    whole[3+j] = n / 1000;
     n = n % 1000;
-    num[2] = n / 100;
+    whole[2+j] = n / 100;
     n = n % 100;
-    num[1] = n / 10;
-    num[0] = n % 10;
+    whole[1+j] = n / 10;
+    whole[0+j] = n % 10;
   }
   //else n is bigger than the display, so display 0
   else
-    num[0] = 0;
+    whole[0] = 0;
+
+  for(int i=0; i<4; i++) {
+    if(whole[i]!=-1) {
+      num[wholePosition] = numbers[whole[i]];
+      wholePosition++;
+    }
+  }
+
+  return wholePosition;
 }
 
 void updateShiftRegister(byte leds) {


    pickDigit(refreshLoop);
    displayNumber();

    refreshLoop++;
  }


    testLoop ++;

    //reset loop to 0 at end of displayable integers
    if (testLoop == resetTestLoop)
      testLoop = -999;
  }
}
