in reply to Acceleration ETA algorithm

How is this supposed to work?

say eta(1, 100, 1);

says 13.1067359796659 (shouldn't it be 100?). OK, with another call:

say eta(2, 100, 2);

says "Illegal division by zero" -- because $total_weight is zero.