Subject: [boost] [rational] PATCH: Use ordered_euclidean_ring_operators
From: Mario Lang (mlang_at_[hidden])
Date: 2010-10-30 18:45:46
Below is a patch which makes rational.hpp use grouped arithmetic
While we are at it, use ordered_euclidean_ring_operators instead
of just ordered_field_operators. While it might sound
strange at first, mod can make sense even for rational numbers.
For instance, Common Lisp, which has a native rational type,
works fine if mod is used on rational numbers...
template <typename IntType>
rational<IntType>& rational<IntType>::operator%= (const rational<IntType>& r)
return *this -= r * floor(rational_cast<double>(*this / r));
I am aware that the use of floor() is probably problematic.
I am all open for comments and suggestions for improvements.
â¡â â â â
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk