Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
sobankumar ilango

New User

Joined: 05 May 2011
Posts: 3

 Posted: Thu May 05, 2011 2:00 pm    Post subject: Deduction rounding off error deduction amount = 558.71 there are two children CS1 and CS2 both of them are expected to get CS1=279.35 and CS2=279.36 during calculation am using ( compute) values are getting rounded off to 279.36 and 279.36 ie it is actually exceeding the deduction amount 279.36+279.36=558.72

enrico-sorichetti

Global Moderator

Joined: 14 Mar 2007
Posts: 10456
Location: italy

 Posted: Thu May 05, 2011 2:22 pm    Post subject: Reply to: rounding off error in general for rounding issues for financial/IR processes ask Your organization to inquire at the IR offices about the standard/approved ways of carrying on the computations in Italy for example the computations must be carried on with 4 decimal digits and displayed with two let' s not quarrel that sometimes there might be differences, but in my numbers(apple equivalent of excel ) worksheet after I made the changes everything has been checking out properly for qite a few years. the best way is to ask the powers that be ! anyway for the particular case You are out of luck dividing by two and rounding even with the proper rules it will alway result in an arithmetic mismatch
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7314

Posted: Thu May 05, 2011 2:45 pm    Post subject: Re: rounding off error

 sobankumar ilango wrote: deduction amount = 558.71 there are two children CS1 and CS2 both of them are expected to get CS1=279.35 and CS2=279.36 during calculation am using ( compute) values are getting rounded off to 279.36 and 279.36 ie it is actually exceeding the deduction amount 279.36+279.36=558.72

To get your specific result, where the remainder is allocated to a specific place, don't use ROUNDED.

You can use DIVIDE x BY y GIVING z REMAINDER a (sorry, bad planning).

Then add the "a" to the required field.

If you want to do it with COMPUTE, don't do the rounding, let it truncate, then subtract everything from the original amount and put whatever is left after this into your specific place.
sobankumar ilango

New User

Joined: 05 May 2011
Posts: 3

 Posted: Thu May 05, 2011 3:15 pm    Post subject: thanks for the reply..I think I should make myself more clear.. the program selects the dependents(children in this case) in a pro ration manner IE one by one and processes until the dependents are zero.( dependents are not always two). I cannot get rid of round up option ( also it wont help).. is there a solution for this problem ? someone plzzzzzzzz help me !!!!!!
GuyC

Senior Member

Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

 Posted: Thu May 05, 2011 3:24 pm    Post subject: two algorythms : 1 ) give the last one , what ever is left. suppose deduction = 20 ; dependents = 3 1st : 20. / 3 = 6.67 2nd: 20. / 3 = 6.67 3th: 20 - 6.67 - 6.67 = 6.66 2) remember leftovers. 1st: 20 / 3 = 6.67 => left = 13.33 / 2 2nd: 13.33 / 2 = 6.67 => left = 6.66 / 1 3th: 6.66 / 1 = 6.66
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7314

 Posted: Thu May 05, 2011 3:26 pm    Post subject: Reply to: rounding off error It doesn't matter how many you divide by, what matters is you know where the "balancing" part is to go. Why do you think you can't get rid of the rounding? If you have to keep it, you have to work "upside down", in that you have to subtract your balancing item, and the specific place you want it to go will be less than all the others, not greater. Divide Money-amount by Number-of-dependents giving Amounts-which-are-equal-per-dependent remainder Balancing-amount-which-is-not-equally-divisible (might be zero at times, won't ever be very big). Each dependent gets Amounts-which-are-equal-per-dependent and one (your choice which) gets Amounts-which-are-equal-per-dependent plus Balancing-amount-which-is-not-equally-divisible. Try it out, at least, then tell me your problems with the result.
sobankumar ilango

New User

Joined: 05 May 2011
Posts: 3