From: Moore, Paul (paul.moore_at_[hidden])
Date: 2001-01-22 05:14:22
From: Stephen Silver [mailto:boost_at_[hidden]]
> Paul Moore wrote:
> > > http://www.argentum.freeserve.co.uk/cpp/rational.zip
> > This is nice. Would you have any objections to me including it in
> > the rational library, as a regression test?
> No objections. I already gave it a Boost-compliant copyright notice.
Thanks. I noticed the copyright was OK, but I thought I'd better ask anyway.
I've made a few cosmetic changes as well (don't fail on the first error, and
report number of failures). I've also added a trivial user-defined integer
type (just wrapping int) which I can use to test the user-defined type
> > Your example
> > std::istringstream iss("57A");
> > iss >> r0;
> > consumes "57". This is a valid representation of a rational, namely
> > 57/1, so r0 is set to this, and the stream is in a good state.
> OK. But in that case the documentation needs changing, because it
> The external representation of a rational is two integers,
> separated by a slash (/). On input, there must be no space
> between the numerator and the slash.
> which seems to imply that anything without a / is not a valid input.
> (Also, the above requirement seems lacking in symmetry. Would it not
> be better if it either allowed spaces both sides of the / or
> disallowed them both sides?)
Agreed. I spent a while trying to work out what was going on, and I never
thought to check back on how I'd documented it all :-) I'll tidy up as you
suggest. (Actually, I'm now wondering whether the numerator-only
representation is worth the confusion it causes. Any comments based on
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk