> In the financial world, the greatest precision (not the same as
> accuracy) is three decimal places -- in dollar/penny currencies, a tenth

Four, actually. Well really it depends on the application.

In Forex the exchange rate might be quoted;  USD/AUD (bid)0.5385 (ask)0.5544
. It might be even more considering the Yen as well, given it trades like
less than one yen to the US cent, so when it is quoted as USD/JPY (as
opposed to JPY/USD) the rate is miniscule, like 0.0082 ... possibly there is
more precision involved, actually I have to check that today. If your
maximum precision was only three decimal places then you could not discern
any difference between the bid and the ask price nor calculate a spot mid
rate -- your JPY traders wouldn't be able to make any money and I think
senior management might get a  little pissed off. ;)

Also I think that some shares on the LSE trade in .25 pence ticks and as for
other markets, the tick amount is dependant on the value the share trades
at.

Then there's derivatives, like futures and options (and options on futures).
On the North American markets they still insist on trading in fractional
amounts like 1/128ths or 1/32nds.

Anyway, dependant on the market you are operating in the precision can be
much more than 1/10ths of minor units.

For currencies the best way around it I have found is to use integers only,
(I had to roll my own Currency class in the end) but floating point
arithmetic can't be avoided (with Forex anyway) and frankly I would always
choose accuracy over performance. Those little one hundredths of a cent may
seem insignificant but multiply them by millions and then they are not!!! I
don't want someone coming back to me and telling me $100,000 was lost on a
trade because of an arbitrary decision I took about the required accuracy of
a calculation.

regs
scot.

___________________________________________
Scot Mcphee -                 Snr Developer
            -       (mobile) +61-412-957414
___________________________________________
Tigerex     -        http://www.tigerex.net
            -          (bus) +61-2-82593613
___________________________________________




To change your JDJList options, please visit: http://www.sys-con.com/java/list.cfm

Reply via email to