Boost logo

Boost :

From: Guillaume Melquiond (guillaume.melquiond_at_[hidden])
Date: 2005-03-26 02:50:49


Le vendredi 25 mars 2005 à 19:36 -0700, Jonathan Turkanis a écrit :

> I'm definitely committed to keeping the current behavior available as an option.
> I'm also strongly inclined to make sure it is the default behavior, now that I
> have verified that the template is indeed used ;-)
>
> Andras's proposal to add optional rounding or error checking seems reasonable,
> but I can't really justify adopting it if there is only one interested user.

If the rational type supports rounding (up and down), it will become a
target for interval arithmetic, a possible alternative to floating point
types.

It is already possible to apply rationals of big integers to interval
arithmetic. The ranges are computed exactly, but the computations get
slower when the rationals get bigger. Floating point types do not suffer
from this limitation, since their fixed precision allows for
constant-time computations. But the results suffer from rounding to
dyadic numbers (m*2^n).

With rounded rational numbers, you would get a bit of both worlds: the
computations would still be constant-time, and yet you would keep the
exactness of the results for the smaller rationals. And since it is
interval arithmetic we are talking about, the loss of precision for the
bigger rationals is no problem at all (as long as there is up and down
rounding).

Best regards,

Guillaume


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk