Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-11-28 08:48:24


----- Original Message -----
From: "Moore, Paul" <paul.moore_at_[hidden]>
>
> Dave's algorithm using continued fractions is the best bet so far. But in
> order for it to work, I need to be able to portably detect overflow in
> integer types. [[Actually, I've just thought of another problem - if
> rational<T> is used where T is a user-defined unlimited precision integer
> type, the conversion may never terminate!]]

Actually, I'm pretty sure that isn't possible, at least not unless floats
reach infinite precision. I take this hypothesis from the fact that
rationalize(1.0/3) terminates because f == 0, not due to overflow. I don't
have a quick answer to the overflow detection problem, though ;-(.


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