diff --git a/include/real.cpp b/include/real.cpp index 091e6faf2..57313d879 100755 --- a/include/real.cpp +++ b/include/real.cpp @@ -1615,9 +1615,8 @@ const TImporto& TImporto::normalize( int TImporto::compare(const TSortable& s) const { const TImporto& i = (const TImporto&)s; - const real d = valore() - i.valore(); - int res = d.sign(); - if (res == 0 && !is_zero()) - res = sezione() != i.sezione(); + const real v = i.sezione() == sezione() ? i.valore() : -i.valore(); + const real d = valore() - v; + const int res = d.sign(); return res; }