Skip to content

Precision may be lost when saving the exchange rate in the database #479

@rivaldi8

Description

@rivaldi8

When the user enters an exchange rate, it's not saved directly. Instead, the
relation between the original amount and the converted amount is stored. As a
consequence, the exchange rate precision will depend on the precision of the
two currencies.

In addition, the converted amount is (wrongly) stored with the currency of the
original amount and rounded to its decimal places. If the original amount has
no decimal places, even more precision is lost.

For example, if the user transfers from a Yens account (no decimal places) to an
Euros account (2 decimal places) and enters:

  • transaction amount = 10 (Yens, no decimal places)
  • exchange rate = 0.123456

GnuCash calculates:

  • converted transaction amount: 1 (1.23456 rounded to 0 decimals)
  • exchange rate (stored in DB): 1/10 = 0.1

GnuCash should store directly the exchange rate instead of calculating it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions