https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Ugo Jardonnet <jardonnet(a)lrde.epita.fr>
Fix algebra::about_equal.
if abs(a-b) < mln_epsilon(T), a and b are about_equal.
becomes
if abs(a-b) <= mln_epsilon(T), a and b are about_equal.
In particular, this update fix the following bug:
quat q; q.set_unit(); assert(q.is_unit())
could fail even if q != 0;
set_unit() now has is_unit() as postcondition.
I realize that it has to be fix also since q could be equal 0;
* mln/algebra/quat.hh: .
quat.hh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: mln/algebra/quat.hh
--- mln/algebra/quat.hh (revision 1964)
+++ mln/algebra/quat.hh (working copy)
@@ -410,6 +410,9 @@
quat& quat::set_unit()
{
v_.normalize();
+
+ assert(this->is_unit());
+
return *this;
}
@@ -554,10 +557,7 @@
inline
bool about_equal(const T& f, const T& q)
{
- // FIXME: Use abs!
- if (f > q)
- return (f - q ) < mln_epsilon(T);
- return (q - f) < mln_epsilon(T);
+ return math::abs(q - f) <= mln_epsilon(T);
}
inline