[ 
https://issues.apache.org/jira/browse/OFBIZ-4038?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12966819#action_12966819
 ] 

Jacques Le Roux commented on OFBIZ-4038:
----------------------------------------

Jeremy,

My apologies, the rounding was already present in the divide operation, so the 
additional setScale wasn't necessary.



> Rounding error in prorating returned adjustments
> ------------------------------------------------
>
>                 Key: OFBIZ-4038
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4038
>             Project: OFBiz
>          Issue Type: Bug
>    Affects Versions: Release Branch 09.04, Release 09.04, Release Branch 10.04
>            Reporter: Wickersheimer Jeremy
>            Assignee: Jacques Le Roux
>            Priority: Minor
>             Fix For: Release Branch 09.04, Release Branch 10.04, SVN trunk
>
>
> The error is in 
> applications/order/src/org/ofbiz/order/order/OrderReturnServices.java the 
> getAdjustmentAmount method is prorating using this code: 
> newAmount = returnTotal.divide(originalTotal, decimals, 
> rounding).multiply(amount).setScale(decimals, rounding);
> it should be:
> newAmount = returnTotal.multiply(amount).divide(originalTotal, decimals, 
> rounding);
> else by dividing first what should be for example 1/3 of the adjustment ends 
> up being 0.33

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to