Why is it important to bring up precision for currencies?

Suppose you want to convert a particular amount from BDT (Bangladeshi Currency) to USD (US Currency). The precision for both currencies is set to 2. The amount you want to convert from BDT to USD is 123.65. The USD amount will be 1.4588845175418 US Dollars. Since the precision is set to 2, the USD amount will be rounded off to 1.46.

Now convert this 1.46 to BDT again. The amount you will see for BDT will be 123.74. This is happening due to the rounding off.

To avoid this unwanted error, you need to keep in mind that precise currency unit conversion entirely depends on precision.

To solve this issue, let’s set the precision to 4 for both currencies. Now converting BDT 123.6500 will give a US amount of 1.4589 or vice versa.

That means while converting to a larger scale currency unit from a smaller unit or vice versa, you must keep the precision for both currencies at least 4.

Default currency rate should always be 1; additional currency rates should be equivalent to default currency. e.g., If USD is your default currency, then the USD rate is 1; GBP rate will be 0.77