Amount = 1 . From EUR to USD | Exchange rate as per table- EUR = USD * 2 Decimal shift is on so value passed*10 power(2 – number of decimal in source currency) Value passed = 1*10^(2-0) = 100 Now apply Exchange = 100 * 2 = 200 |
Amount = 1 . From GBP to USD | Exchange rate as per table- GBP = USD * 1.6 Decimal shift is on so value passed*10 power(2 – num of decimal in source currency) Value passed = 1*10^(2-0) = 100 Now apply Exchange = 100 * 1.6 = 160 |
Amount = 1 . From JPY to USD | Exchange rate as per table- JPY = USD / 114.75 Decimal shift is on so value passed*10 power(2 – num of decimal in source currency) Value passed = 1*10^(2-0) = 100 Now apply Exchange = 100 / 114.75 = 0.87 |
Amount = 1 . From USD to USD | Exchange rate as per table- USD = USD * 1 Decimal shift is on so value passed*10 power(2 – number of decimal in source currency) Value passed = 1*10^(2-0) = 100 Now apply Exchange = 100 * 1 = 100 |
Amount = 12345 . From USDN to USD | Exchange rate as per table- USDN = USD / 1 Decimal shift is on so value passed*10 power(2 – number of decimal in source currency) Value passed = 12345*10^(2-5) = 12345*10^-3 = 12.345 Now apply Exchange = 12.345/1 = 12.345 Same for amount 54321 |
Target currency – Decimal 0 (in table USD has 0 decimal)
DECIMAL_SHIFT | DECIMAL_SHIFT_BACK | |
Amount = 1 . From EUR to USD | Exchange rate as per table- EUR = USD * 2 Decimal shift is on so value passed*10 power(2 – num of decimal in source currency) Value passed = 1*10^(2-0) = 100 Now Exchange = 100 * 2 = 200 | Result / 10 power(2- Num of decimal in target currency) Result = 200 / (10^(2-0)) = 2 |
Amount = 1 . From GBP to USD | Exchange rate as per table- GBP = USD * 1.6 Decimal shift is on so value passed*10 power(2 – num of decimal in source currency) Value passed = 1*10^(2-0) = 100 Now Exchange = 100 * 1.6 = 160 | Result = 160 / (10^(2-0)) = 1.60 |
Amount = 1 . From JPY to USD | Exchange rate as per table- JPY = USD / 114.75 Decimal shift is on so value passed*10 power(2 – num of decimal in source currency) Value passed = 1*10^(2-0) = 100 Now Exchange = 100 / 114.75 = 0.87 | Result = 0.87/(10^(2-0)) = 0.087 for 2 decimal digit it is 0.01 |
Amount = 1 . From USD to USD | Exchange rate as per table- USD = USD * 1 Decimal shift is on so value passed*10 power(2 – num of decimal in source currency) Value passed = 1*10^(2-0) = 100 Now Exchange = 100 * 1 = 100 | |
Amount = 12345 . From USDN to USD | Exchange rate as per table- USDN = USD / 1 Decimal shift is on so value passed*10 power(2 – num of decimal in source currency) Value passed = 12345*10^(2-5) = 12345*10^-3 = 12.345 Now Exchange = 12.345/1 = 12.345 Same for amount 54321 | Result = 12.35/(10^(2-0)) = 0.12 Similar for amount 54321 |
Case 4- With Rounding , DECIMAL_SHIT is On, DECIMAL_SHIFT_BACK is On
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
2 | |
2 | |
2 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 |