A typical FOREX price would be carried out to the 4th decimal place; for example, the current price of the GBP against the USD today is 1.2515. I have seen this price carried out to more decimal places.
This is really a two-part question.
First
There are two schemes that I am considering:
a) A floating-point type; double jumps to mind. I'm a bit concerned about rounding error here.
b) An integer type, storing the decimal and integer pieces separately.
Any other realistic options?
Of those ( above ), which one is correct?
Second
In either scheme, I would precisely specify the number of bits used via the <cstdint> library.
How many bits makes sense?
I'm looking to balance accuracy, memory/storage cost, and (of course) performance.
Thx, Keith :^)