We use currency conversion rates for financial calculations. Our currency conversion table stores conversion rates to and from each currency (about 150 world currencies) for each day, going back 20 years. The table has millions of rows. Each conversion rate is stored with 4 decimal places (e.g. USD to EUR $1.5105$).

I was wondering if it's possible to only store rates from other currencies to USD with increased precision and then divide rates for other currencies. For example, if the rate for USD to EUR is $1.5105$ and the rate for USD to Pound is $2.2324$, then the rate from Pound to Euro would be $1.5101 / 2.2324$.

If I want the result of division to have 4 significant decimal places, unaffected by rounding, how many decimal places should dividend and divisor have?


  • 1
    $\begingroup$ No matter how many decimal places you store, there'll always be a possibility that you'll get a different result in the fourth decimal place from the one that you currently store. How important is it that all four decimal places are correct? Also, what do you do about "tiny" currencies such as Indonesian Rupiahs - four decimal places of IDR is roughly equivalent to eight decimal places of USD? Do you really need to be able to show four decimal places for currencies like this? If you can answer these questions, I may be able to produce a coherent answer for you. $\endgroup$ – user22805 Nov 3 '12 at 0:52

"Significant places" is often shorthand for an approximate error bound. The worst case is if you want to represent $9999$ within $1$, which is a fractional error of $10^{-4}$. You are then asking what fractional error is allowable on $a$ and $b$ if you want the fractional error on $\frac ab$ to be less than $10^{-4}$. Since the numbers are small, and we want fractional errors, it is useful to take the logarithm: $\log \frac ab=\log a - \log b$, then take the derivative $\frac {\Delta \frac ab}{\frac ab}=\frac {\Delta a}a-\frac {\Delta b}b$. Roughly, this shows the fractional error in $\frac ab$ might be as high as twice the fractional error in $a$ and $b$ (if they are in opposite directions). If you are storing in decimal and only store five places, you could have still an error of one part in $10^4$ if the number you store is $10000$, but storing six places is safe.


First, we must understand the nature of inaccuracy. As for exchange rates, there are random error caused by fluctuations at the market, and measurement error caused by finite number of digits after point in values. Random error is much greater than measurement at almost all liquid financial markets.

Considering random error we can notice, that it has relative nature, i.e. absolute error is is proportional to the value: $$\varepsilon_x = \frac{\Delta x}{x}$$

Mean relative error of product of statistically independent values is a sum of relative errors of multipliers: $$ \varepsilon_x = \sqrt{\sum \varepsilon_{x_i}^2} \qquad for\quad x = \prod x_i$$ Particularly, in your case relative variances are summed: both measurement error and random, and random is much more than measurement. This is answer to your question. But notice, quotes are often statistically dependend, this way you get biased (usually overestimated) value of relative random error.

In this case is more appropriate to consider relative variances, or stochastic volatility. There are different numerical methods to estimate volatilities.

Another approach is to operate in logarithm values $y_i=\ln x_i$ and calculate their volatilities. Using logarithms you can rewrite you product of quotes as a sum, and their absolute volatilities can be summed. Moreover for for small volatilities: $$\varepsilon_{x_i} \approx \Delta y_i$$

All above is applicable to shares or currencies (which actually have lognormal distribution), but not to interest rates or discount factors. Also one should keep in mind, that almost all quotes are dependend each other, and it is more proper to use covariance matrices.

  • $\begingroup$ Thank you for such an elaborate answer. My math skills are pretty basic, so I won't pretend I understood all the facets of your explanations. I'd appreciate it if you could state a solution in some lament terms. It appears that the logarithm option is a feasible one, but it'd be great if you could provide an explanation on how to apply it to the USD/Pound example listed in my original post. Thank you. $\endgroup$ – user1044169 Nov 6 '12 at 22:24
  • $\begingroup$ As for systematic error you can estimate it as $$\varepsilon = \sqrt{\varepsilon_1^2 + \varepsilon_2^2}$$. If you use floating point type to store quotes, use the same type for product. $\endgroup$ – unixmin Nov 8 '12 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.