Hello people. I found an issue when making a calculation that should work OK. I have fixed it already but was wondering why this happens:
XMONOBJ and XMONTOPROV are 15 2
IVA is 5 2
EVAL(H) XMONOBJ=XMONTOPROV/(1+(IVA/100);
This calculation makes eval(h) truncate all decimals. Even trying 1.00 and 100.00 truncates all decimals.
I had to split the divisor into another variable:
PORCIVA=1+(IVA/100)
EVAL(H) XMONOBJ=XMONTOPROV/PORCIVA;
is there any way i can fool RPG into calculating what i want without doing the split? My guess is that 1+(IVA/100) is being calculated internally with a different size therefore eval(h) does not do what i expect it to do.
By the way, what i am trying to do is that i have a number with an added 12% and i want to substract that value to obtain the original number. IE i have 15.10 and i need to obtain 13.48
XMONOBJ and XMONTOPROV are 15 2
IVA is 5 2
EVAL(H) XMONOBJ=XMONTOPROV/(1+(IVA/100);
This calculation makes eval(h) truncate all decimals. Even trying 1.00 and 100.00 truncates all decimals.
I had to split the divisor into another variable:
PORCIVA=1+(IVA/100)
EVAL(H) XMONOBJ=XMONTOPROV/PORCIVA;
is there any way i can fool RPG into calculating what i want without doing the split? My guess is that 1+(IVA/100) is being calculated internally with a different size therefore eval(h) does not do what i expect it to do.
By the way, what i am trying to do is that i have a number with an added 12% and i want to substract that value to obtain the original number. IE i have 15.10 and i need to obtain 13.48
Comment