Comment 2 for bug 926558

Revision history for this message
Piotr Myszka (pmyszka) wrote :

/src/ru/orangesoftware/financisto/export/csv/CsvImport.java (revision 365):

else if (transactionField.equals("amount")) {
   double fromAmount = Double.parseDouble(fieldValue);
   Double fromAmountDouble = fromAmount * 100.0;
   transaction.fromAmount = fromAmountDouble.longValue();

The correct value (80.46) is lost in the 3rd line, when multiplied by 100.0 - it becomes 8045.999999999 and after conversion to long it becomes 8045.
For a quick hack, the fieldValue should be always right-padded with "1" to avoid this situation (80.461). For a more decent solution, the amount shouldn't probably be even kept as a long value.