Boost logo

Boost :

From: Paul Moore (gustav_at_[hidden])
Date: 1999-12-17 17:08:27

From: Paul Moore [mailto:gustav_at_[hidden]]
> I've just found a solution. It seems to work, although I am fairly confused as
> to the validity of it (or, for that matter, why it works!). I shall explain...
> I think I'm (relatively) happy with this resolution. If anyone has
> comments, let me know, otherwise I'll package up a "final" version and send
> it out tomorrow.

Right. Attached is the final version of rational. I say final, but the abs()
stuff is *still* fairly fragile. It works on MSVC, but that's all I can say. See
the NOTES file for some comments, but basically, I have a sort-of setup of
mingw32, which chokes on the abs() stuff. I'm not sure enough of my mingw setup
to be sure that the rational code is at fault.

I would appreciate comments on how other compilers fare. I'll have to be honest,
though - if it looks like there isn't a realistic lowest common denominator,
I'll give up and either remove abs() altogether, or I'll just implement it as

    abs(r) { return rational((num < 0 ? -num : num), den); }

and ignore the possibility that for a user-defined IntType a specialised abs()
may be more efficient.

Paul (feeling disillusioned....)

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