I have some distances of hole to hole and final over all length of flat. please see below lists.



Cumulative distance (Actual/ rounded):
==========================================
Sr Actual Rounded Final H to H
===============================================
0 0.00 0.0 -
1 24.91 25.0 25.0
2 84.91 85.0 60.0
3 572.72 573.0 488.0
4 1159.58 1159.5 586.5
5 2333.27 2333.0 1173.5
6 3506.97 3507.0 1174.0 * -0.5 mm will be adjusted here
7 4373.40 4373.5 866.5
8 4453.40 4453.5 80.0
9 4518.40 4518.5 65.0
===============================================
Length: 4518.40 4518.5--> 4518
Error:0.10 if length rounded to 0.5
* -0.5 mm to be adjusted in largest H 2 H dist
to round up total length to full digit.


Cumulative distance (Actual/ rounded):
==========================================
Sr Actual Rounded Final H to H
===============================================
0 0.00 0.0 -
1 54.91 55.0 55.0
2 114.91 115.0 60.0
3 264.91 265.0 150.0
4 572.72 573.0 308.0
5 1159.58 1159.5 586.5
6 2333.27 2333.0 1173.5
7 3506.97 3507.0 1174.0 * -0.5 mm will be adjusted here
8 4413.93 4414.0 907.0
9 4493.93 4494.0 80.0
10 4518.40 4518.5 24.0
===============================================
Length: 4518.40 4518.0--> 4518
Error:-0.40 if length rounded to 0.5
* -0.5 mm to be adjusted in largest H 2 H dist
to round up total length to full digit.


I want to do algorithm for above mentioned distances. this is a sample others are vary.

Thanks,

Avinash