def calc_diff(prev, curr):
  """Returns percentage difference between two values."""
  return ((curr - prev) / prev * 100.0 if prev != 0 else float("inf") *
          abs(curr) / curr if curr != 0 else 0.0)