|
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 09.04, Release Branch 09.04, Release Branch 10.04 Reporter: Wickersheimer Jeremy Priority: Minor 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. |
|
[ https://issues.apache.org/jira/browse/OFBIZ-4038?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jacques Le Roux closed OFBIZ-4038. ---------------------------------- Resolution: Fixed Fix Version/s: SVN trunk Release Branch 10.04 Release Branch 09.04 Assignee: Jacques Le Roux Thanks Jeremy, Your suggested change is trunk at r1042034 ,R10.04 at r1042036, R9.04 at r1042037 It may seem obvious, but I would just have preferred that you would not have omited the setScale part. :p > 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. |
|
In reply to this post by Nicolas Malin (Jira)
[ 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. |
| Free forum by Nabble | Edit this page |
