$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: [boost] [rational] PATCH: Use ordered_euclidean_ring_operators
From: Mario Lang (mlang_at_[hidden])
Date: 2010-10-30 18:45:46
Hi.
Below is a patch which makes rational.hpp use grouped arithmetic
operators.
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.
--
Thanks,
â¡â â â â