
On 12/11/04 5:03 AM, "Andras Erdei" <aerdei@gmail.com> 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.] [SNIP]
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