Boost logo

Boost :

Subject: Re: [boost] [mpl-cf] [RFC] MPL Real Numbers using Continued Fractions
From: Hal Finkel (half_at_[hidden])
Date: 2010-11-29 10:24:09

On Mon, 2010-11-29 at 11:07 +0100, Mathias Gaunard wrote:
> On 28/11/2010 22:30, Hal Finkel wrote:
> > Hello,
> >
> > A few months ago, I created an MPL extension type for representing real
> > numbers.
> I find that idea very interesting.
> > The current default is 20 to allow an effective
> > precision near that of a double. Also, continued fractions, being "based
> > on" rational numbers, can exactly represent any rational (for example,
> > 1/3) so the computations can be more accurate than those using a
> > floating-point representation.
> It would be nice to know what minimum value is necessary to provide
> correctly rounded results for IEEE754 floats and doubles.

This depends on the number: For a rational, you need only two
integers ;) For a general real number, it depends on the rate of
convergence. In my experience, you get about one decimal digit per
integer coefficient, so 10 is sufficient for single precision, 20 for
double precision (and long double too on an x86, since the extended type
there is only 18 digits). The MPL containers generally come in
max-size-increments of 10, but it would not be too hard to generate
something else.


> _______________________________________________
> Unsubscribe & other changes:

Boost list run by bdawes at, gregod at, cpdaniel at, john at