anchor.diff:      {Sum1, Len1} = with_current_value(X),
       NewSum = Sum + Sum0 + Sum1,
       NewLen = Len + Len0 + Len1,
  -    Avg = NewSum / NewLen,
  +    Avg = safe_avg(NewSum, NewLen),
       moving_average(Xs, Ls, NewSum, NewLen, [Avg | Acc]).
   
   
  
positive.code:      ?_assertEqual([6/3], moving_average([1,4,1], 3)),
       ?_assertEqual([6/3], moving_average([1,4,1], 4)),
       ?_assertEqual([1/1,4/1,1/1], moving_average([1,4,1], 1)),
       ?_assertEqual([5/2,9/3,10/3,9/3,6/3,4/3,2/2], moving_average([null,2,3,4,3,2,1,1,null], 3))
      ].
  
  percentile_test_() ->
  
negative.code:            (A, B) -> <<A/binary, ".", B/binary>>
          end,
      lists:foldr(F, <<>>, Parts).
  
  
  with_timestamps(Values, Start, Step) ->
      with_timestamps(Values, Start, Step, []).
  
  with_timestamps([], Start, Step, Acc) ->
      lists:reverse(Acc);
  with_timestamps([V | Vs], Start, Step, []) ->
      with_timestamps(Vs, Start, Step, [{Start, V}]);
  with_timestamps([V | Vs], Start, Step, [{TS, _} | _] = Acc) ->
      with_timestamps(Vs, Start, Step, [{TS + Step, V} | Acc]).
  
  
  safe_average(Values) ->
  