From: Bill Seymour (bsey_at_[hidden])
Date: 2001-05-14 06:46:20
Daryle Walker asked:
> Could/should we have a version of the "div" function
> defined for rational numbers?
How about something analagous to fmod(double, double)
and modf(double, double*)?
A while back before I knew about Boost, I wrote a non-templated
rational number class that had member functions:
int trunc() const
return div(num, den).quot;
return std::div(num, den).quot;
rational modr(rational* iptr) const
return rational(*this) -= (*iptr = trunc());
rational rmod(const rational& rhs) const
temp /= rhs;
int i_part = temp.trunc();
temp -= ipart;
(OK, they should be free functions, not member functions;
but you get the idea.)
Is that what you want?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk