title: Is double the correct datatype to calculate decimal percentage?
body: <p>I want to calculate percentage in my project and I am using double for that. Suggest me the correct data type to calculate percentage in decimal like 18% of 5.368 should give 0.966 exact.</p>
  
  <p>I want the result truncated to 3 decimal places.</p>
  
  <p>I am using this: </p>
  
  <pre><code>EditText kundan = (EditText) findViewById(R.id.kundan);
  double kundangiven = Double.parseDouble(kundan.getText().toString());
  EditText loss = (EditText)findViewById(R.id.losspercentage);
  double lossinkundan = Double.parseDouble(loss.getText().toString());
  losspercent  = (lossinkundan * kundangiven) / 100 ;
  losspercent = losspercent % 10 ;
  displayTotalloss(losspercent);
  </code></pre>