- 04 Aug 2021
- 1 Minute To Read
- Print
- DarkLight
- PDF
Truncating and rounding interest
- Updated On 04 Aug 2021
- 1 Minute To Read
- Print
- DarkLight
- PDF
In daily life, it is uncommon to use more than two decimals. Interest calculations are done with a precision of 20 decimals, both for calculation and storage in the database. Journal Entries aggregate interest accruals with 10 decimals, rounded to the base currency's decimal preference. Interest amounts are rounded based on the currency's preset decimals, such as two for American Dollar and three for Jordanian Dinar. The option to round repayment currency at the product level can be set to No Rounding, Round to Nearest Whole Unit, or Round Up to Nearest Whole Unit.
It's uncommon to use more than two decimals in daily life. In order to show usable values we truncate and round interest to display a whole number or a number with fewer decimals.
Number of decimals used for interest calculation
We use a precision of 20 decimals for the calculation of interest accruals.
Number of decimals stored in the database
When storing the interest accruals in the database, we use the same precision of 20 decimals for the amount of interest accruals.
Number of decimals displayed in Journal Entries
For Journal Entries (JE) tables, we calculate the interest accrual aggregate per loan product, which is the aggregation of all interest accruals taken from all the loan accounts created under the respective product. Therefore we sum the related interest accrual amounts that contain 10 decimals and we round the end result to the number of decimals requested by the base currency of the tenant (please see below).
Number of decimals used for the amounts
The interest amount is rounded to the number of decimals preset on the base currency (zero for Japanese Yen (JPY), two for American Dollar (USD) and European Euro (EUR), three for Jordanian Dinar (JOD), eight for Bitcoin, and so on).
The currencies available and their decimal number are available under Administration > Financial Setup > Currency > Add Currency:
Then, the Rounding of Repayment Currency option selected at product level is taken into account:
- No Rounding: Decimals are left as they are.
- Round to Nearest Whole Unit: 62.22 becomes 62 and 62.52 becomes 63.
- Round Up to Nearest Whole Unit: 62.22 becomes 63.