From: Hubert HOLIN (Hubert.Holin_at_[hidden])
Date: 2001-09-26 16:40:08
Paris (U.E.), le 26/09/2001 (just in time...).
I have only had the time to look at the gcd/lcm library.
I recommend Boost accept that library. It is useful and
correct (including the special cases).
A few comments are in order, however:
1) use of the "%" operator might lead to portability problems, as noted
by another; the best fix would probably be to move to positive numbers
2) no way (that I could fathom) to simply detect an overflow if one
occurs, in lcm (there is a multiplication that really can overflow),
static or runtime versions.
3) possible truncation problems, in lcm, if the computation in unsigned
long does not overflow, but the data are actually, say, short, and the
result is not representable as a short.
4) intermediate computations are done in "unsigned long" in a hardwired
mode, but it might be interesting to be able to use a bigger type if an
implementation did provide one, otherwise the computation may lead to
5) use of this library for other integer-like type (say a "big
integer") necesitates to specialise internals of this library for this
other type, instead of requiring that the new type defines the
necessary algorithmic behavior; this is bad from an orthogonality point
of view; this is also the converse of our discussion about sync's
template template parameter :-)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk