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

Miles Huang commented on OFBIZ-2833:
------------------------------------

May I suggest if someone familiar with JDBC specification can check this 
problem?
If the JDBC specification has clarified that the JDBC driver should do the 
number round operation in round half up mode, then its okay that OFBiz relies 
on the JDBC specification to do the round operation. This issue could be 
considered as a Derby bug.
Otherwise, may we still consider this is an OFBiz bug? Although this bug 
condition will not be triggered on some specific kinds of DB, it may be 
triggered by others, may be someday in the future.

Best Regards,
Miles.





> Receive offline payment (May be the Entity Engine) has decimal precision 
> problem
> --------------------------------------------------------------------------------
>
>                 Key: OFBIZ-2833
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-2833
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework, order
>    Affects Versions: Release Branch 9.04, SVN trunk
>         Environment: The Database I'm used for testing is the built in Derby. 
> I'm not sure if other DBMS has same problem.
>            Reporter: Miles Huang
>
> Reproduce the problem is simple. In Order Manager Application, simply enter 
> an offline payment for a sales order with amount $65.30, the payment amount 
> stored in the DB will change to $65.29.
> Digging into the code, in the 
> org.ofbiz.order.OrderManagerEvents.receiveOfflinePayment method, although the 
> passed in amountStr is "65.30", the parsed out BigDecimal paymentTypeAmount 
> have value "65.2999999999999971578290569595992565155029296875". Checking the 
> payment amount stored in the Payments entity use web tools, the result is 
> 65.29. And the order still has $0.01 outstanding amount.
> Parse the BigDecimal value from string directly may solve the problem 
> partially. But imagine if someone enters $65.299, the problem is still there.
> Or a better and safe solution, in Entity Engine, always round half up 
> BigDecimal value to the same precision as the corresponding DB column before 
> insert/update?

-- 
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