Boost logo

Boost :

From: rwgk_at_[hidden]
Date: 2001-01-31 22:32:41


The current version of rational.hpp has a problem with a comparison
like this:

  0 < -1/2

The result is "true."

Here is my idea of a fix:

RCS file: /cvsroot/boost/boost/boost/rational.hpp,v
retrieving revision 1.4
diff -r1.4 rational.hpp
48a49
> if (n < 0) return -n;
56a58
> if (n < 0) return -n;

This is, the functions gcd and lcm are modified such that they always
return a positive number.

Ralf


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