Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2004-12-20 19:52:30

On 12/11/04 5:03 AM, "Andras Erdei" <aerdei_at_[hidden]> wrote:

[The problem: It occurs when using boost::rational with limited-size integer
types, typically the built-in ones. A basic rational operation may have the
numerator and/or denominator overflowing, leading to a garbage "sideflowed"
result, even though the true result is between representable values.]

> fixing rational<> to work with finite precision integers
> so that for calculations like the above we get the best
> representable approximation (in this case 3197/1540 =
> 2.076, precise to 7 digits) is pretty straightforward
> -- the gcd() function implicitly calculates all
> representable approximations -- but would require
> rewriting the whole class

I would like to see precise directions of the algorithms that give the
closest representable result (that have to try avoiding internal overflow).

Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT hotmail DOT com

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