title: SQLite how to use integer for storing price value
body: <p>I am using real type to save price value in SQLite database but it does not return correctly value. If I save a few values like <code>1.01</code> it will return <code>4.029999999999999</code>.
  I have read that best way to save prices in SQLite is to use integer <a href="https://dba.stackexchange.com/questions/15729/storing-prices-in-sqlite-what-data-type-to-use">type</a> </p>
  
  <p>But I don't know how to use it.
  How to store and retrieve prices in this case?
  Here code how I retrieve price now:</p>
  
  <pre><code>    Cursor cursor = null;
      double totalPrice = 0;
      try {
          cursor = mDB.rawQuery("select " + Expense.PRICE + " from " + Expense.TABLE_NAME + " where " + " (strftime("
                  + dateType + ", " + Expense.DATE + "))" + "= ? ", new String[] { currentDate });
  
      } catch (Exception e) {
          Log.e(TAG, "error" + e.toString());
          e.printStackTrace();
      }
      for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
          totalPrice += cursor.getDouble(cursor.getColumnIndex(Expense.PRICE));
      }
  </code></pre>