Floating Sum Stability
Computer Mathematics
Hard
2 views
Previous
No previous question
Next
No next question
Problem Description
Given n decimals, sum them and print with 6 decimals (show stable summation idea).
Input Format
n then n decimals.
Output Format
One number.
Official Solution
Use Kahan summation: keep compensation c. For each x: y=x-c; t=sum+y; c=(t-sum)-y; sum=t.
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!