How best to sum up lots of floating point numbers?

前端 未结 5 1561
我寻月下人不归
我寻月下人不归 2020-11-28 22:11

Imagine you have a large array of floating point numbers, of all kinds of sizes. What is the most correct way to calculate the sum, with the least error? For example, when t

5条回答
  •  离开以前
    2020-11-28 22:25

    If your application relies on numeric processing search for an arbitrary precision arithmetic library, however I don't know if there are Python libraries of this kind. Of course, all depends on how many precision digits you want -- you can achieve good results with standard IEEE floating point if you use it with care.

提交回复
热议问题