Summing a list of floating-point numbers
See original GitHub issueWhat is the purpose of sorting these floats? After sorting, they are summed and their total is returned. The ResizeArray
was created in this scope and no references remain after the function returns. Maybe it was added at one point to help with debugging.
I think this sorting can be removed.
Issue Analytics
- State:
- Created 3 years ago
- Comments:21 (12 by maintainers)
Top Results From Across the Web
Sum of float numbers in a list in Python
To sum float from a list , one easy way is to use fsum import math l=[0.0, 0.0, 1.0, 0.0, 0.25, 0.25] math.fsum(l)....
Read more >Python sum()
Output: 7.0 If you want to add floating point values with extended precision, you can use math.fsum() function. Python sum of complex numbers....
Read more >How to Sum a List of Float numbers in Python
Use the map.fsum() method to sum a list of float numbers in Python. The math.fsum() method returns an accurate sum of the floating-point...
Read more >Summing an array of floating point numbers | Kahan
This post will look at Kahan's algorithm, one of the first non-obvious algorithms for summing a list of floating point numbers.
Read more >Python sum() Function
Example two of sum() has a list of floating-point values. We again pass that list of floating-point numbers to the sum() function, and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That is very clever. Thanks for the explanation and specific example.
I will make sure there is a test that fails if the sort is removed before closing this issue.
That’s fine. PR #170 is just a proof of concept.