Subject: Re: [boost] [mpl-cf] [RFC] MPL Real Numbers using Continued Fractions
From: Karsten Ahnert (karsten.ahnert_at_[hidden])
Date: 2010-11-30 10:11:06
> Actually, ignore that statement. You only need two integers for a0 +
> 1/a1, in general you need more. For example, if you look at the test
> program (basic.cpp in the archive), it provides some examples (where the
> floating-point output is float, double, long double):
> 3/2 + 1/4 = [ 1 1 3]
> 1/7 + 1/15 = [ 0 4 1 3 2 2]
> There are other continued fraction representations where any rational
> can be represented with a fixed number of integers (a0 + b0/(a1 + ...)),
> but the algorithms are a little more complicated, and I fear the compile
> times would increase.
I was looking for something very similar to that, altough I believe
compile times are to long for realistic problems. Especially the example
with sine and cosine took approximately 10 minutes on my PC. But who
knows? Maybe compilers are fast enough in some years...
I have also two little questions:
1. Can one express for example 1.25e-10 in an easy manner, for example
by simply specifying the exponent?
2. Can one use different representations of rational number, maybe
boost::ratio? I guess this could be difficult to work with the
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk