title: My simple calculator don't do operations fine with double number
body: <p>I'm doing a basic calculator and seems that works fine, unless when I try to sum/divide... a double number like for example 5.5</p>
  
  <p>Then, if I try do this: 5.5 + 1 the result that I get is 56 and not 6.5. Seems that my logic don't take the point when do the operations.</p>
  
  <p>Some help will be apreciate!</p>
  
  <p>This is my code:</p>
  
  <pre><code>for (int i = 0; i &lt; inputText.getText().toString().length(); i++) {
                  if (Character.isDigit(inputText.getText().toString().charAt(i))) {
                      val += inputText.getText().toString().substring(i, i + 1);
                      if (i == inputText.getText().toString().length() - 1) {
                          vals.add(Double.parseDouble(val));
                      }
                  } else if (inputText.getText().toString().substring(i, i + 1).equals("+")) {
                      vals.add(Double.parseDouble(val));
                      signs.add("+");
                      val = "";
                  } else if (inputText.getText().toString().substring(i, i + 1).equals("-")) {
                      vals.add(Double.parseDouble(val));
                      signs.add("-");
                      val = "";
                  } else if (inputText.getText().toString().substring(i, i + 1).equals("*")) {
                      vals.add(Double.parseDouble(val));
                      signs.add("*");
                      val = "";
                  } else if (inputText.getText().toString().substring(i, i + 1).equals("/")) {
                      vals.add(Double.parseDouble(val));
                      signs.add("/");
                      val = "";
                  }
              }
  
   double result = 0;
          for(int i=0; i &lt; vals.size(); i++){
              if (i == 0){
                  result = vals.get(i);
              }
              else {
                  String sign = signs.get(i-1);
                  switch (sign){
                      case "+":
                          result = vals.get(i) + result;
                          break;
                      case "-":
                          result = result - vals.get(i);
                          break;
                      case "/":
                          result = result / vals.get(i);
                          break;
                      case "*":
                          result = result * vals.get(i);
                          break;
                  }
              }
          }
  
   1. I think that the problem is in this part of the code:
  
                  //I can check the value of vals is 5.5 here when do the first loop in for loop
                  ArrayList&lt;Double&gt; vals = new ArrayList&lt;&gt;();
  
      //but here the value of val is 55 and not 5.5
      val +=  inputText.getText().toString().substring(i, i + 1); //Then, I'm
          adding in the array the 55 instead the 5.5 if (i ==
          inputText.getText().toString().length() - 1) {
                                  vals.add(Double.parseDouble(val));
                              }
  </code></pre>