Andy
Thanks for replying. To clarify... in financial
calculations there may be a requirement to resolve
complex mathematical formulae on what are ostensively
rational numbers (fractions) e.g. an exchange price from
a market feed. 4563.23 being involved in a calculation
with 10 other variables each with between 0 and 5 decimal
places. Clearly using floating point representations the
calculations here would result in dramatically inaccurate
answers as not all decimal fractions can be accurately
represented by a floating point number. This is where
rational numbers come in as the allow completely accurate
representations of fractions and support all the standard
mathematical operators.
As stated Boost have such a library
(
http://www.boost.org/boost/rational.hpp) which I have
used in our proprietary trading system and it works a
treat so I was looking to source something like that to
save me the pain of hand rolling it.
BTW this is a templatized class and in practice I have
used int64 as the template parameter.
int64 on its own is not sufficient as the range
representated may not be wide enough in all cases or one
would have to may undue attention to the order of sub-
calculations to guarantee that overflow does not occur.
Hope this clarifies my question.
Cheers
Mike
-----Original Message-----
I'm not sure what your problem is
AFAIK, a "long" in .net is a 64-bit integer. Enough for most financial
applications surely?
Mike Friel said:
I am writing an assembly that will be used in a suite of
financial applcations. Naturally I must use integer
arithmetic to ensure the accuracy of my calculations and
in the past [in c++] have used the rational number class
from the Boost libararies. Is there anything out there
like that or for that matter in the framework that I am
missing.
Cheers
Mike
.