Follow-up Comment #2, patch #8052 (project pspp):


+      /* Sum of reciprocals only needed for variables with only positive
values */
+      m->sumreci = (value <= 0. || m->sumreci == SYSMIS) ? SYSMIS :
m->sumreci + 1 / value * weight;

I don't understand why there is this exception for values less than or equal
to zero.

The harmonic mean is well defined for negative values, so we don't need to
make a special case there.  Where a value is exactly equal to zero, the
reciprocal of course is infinite.  However since we are dealing with floating
point numbers, this will be recognised by the floating point library and the
end result will be (correctly) NaN.  So as far as I can see, we don't need to
special case zero either. 

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?8052>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/


_______________________________________________
pspp-dev mailing list
pspp-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/pspp-dev

Reply via email to