private String toString(double number)
   {
	   String result="";
	   if (Double.toString(number).equals("NaN")||Double.toString(number).equals("Infinity"))
	   {
		   result="Error";
	   }else{
		   result=Double.toString(number);
                   //if it's an integer, remove ".0"
                   if (result.substring(result.length()-2,result.length()).equals(".0"))
                   {
                       result=result.substring(0,result.length()-2);
                   }
                   //get rid of negative zero
                   if (result.equals("-0"))
                   {
                       result="0";
                   }
	   }
	   return result;
   }