anchor.diff:      safe_length(Xs, Len + 1).
   
   
  +-spec safe_max(variadic_metrics()) -> metric_value().
   safe_max(Vs) ->
       safe_max(Vs, null).
   
  
positive.code:     safe_range(Vs, MinMax).
  
  
  safe_diff([]) -> 0;
  safe_diff([{_TS, Value} | Vs]) -> safe_diff(Vs, Value);
  safe_diff([Value | Vs]) -> safe_diff(Vs, Value).
  
negative.code:     sort_non_null(Vs, [Val | Acc], Len + 1).
  
  
  -spec median([metric_value()]) -> metric_value().
  median(Values) ->
      percentile(Values, 50, true).
  
  
  -spec percentile([metric_value()], integer()) -> metric_value().
  percentile(Values, N) ->
      percentile(Values, N, false).
  
  -spec percentile([metric_value()], integer(), boolean()) -> metric_value().
  percentile(Values, N, Interpolate) ->
      {Sorted, Len} = sort_non_null(Values),
      FractionalRank = (N / 100.0) * (Len + 1),
  