Rounding Error with Decimal Sum

Hi.

Please I’m getting this unusual rounding error when summing numbers using the Decimal Library

My result is off by 0.01

  208,505,442,949.08 # Excel
  208,505,442,949.09 # sum function with Decimal

Any suggestions please?

Thanks.

def sum() do
    f = "C:/Downloads/MMR100.txt"
    {:ok, b} = :file.read_file(f)
    a = String.split(b,"\n")
    c = Enum.count(a)
    IO.puts c # 299,725

    _sum(a, "0.00") |> Decimal.to_string(:normal)

    # 208,505,442,949.08 - Excel
    # 208,505,442,949.09 - sum
  end

  defp _sum([], acc), do: acc
  defp _sum(["" | rest], acc), do: _sum(rest, Decimal.add("0", acc))
  defp _sum([v | rest], acc), do: _sum(rest, Decimal.add("#{v}", acc))