[jira] [Commented] (OFBIZ-6386) compareBigDecimals in org.ofbiz.minilang.method.conditional.Compare does not compare certain values correctly

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-6386) compareBigDecimals in org.ofbiz.minilang.method.conditional.Compare does not compare certain values correctly

Nicolas Malin (Jira)

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

Mridul Pathak commented on OFBIZ-6386:
--------------------------------------

I have reviewed both the patches and gone through whole conversation. Gareth's observations seems correct. "compareBigDecimal" method seems to be performing unnecessary rounding before comparison. BigDecimal.compareTo() already takes care of variable scale while comparing, so I don't think we need to explicitly set scale using rounding before comparison. I think it should be ok to commit v1.patch.

Looking forward to opinion from other community members.

> compareBigDecimals in org.ofbiz.minilang.method.conditional.Compare does not compare certain values correctly
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-6386
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-6386
>             Project: OFBiz
>          Issue Type: Bug
>    Affects Versions: Trunk
>            Reporter: Gareth Carter
>            Assignee: Mridul Pathak
>            Priority: Minor
>         Attachments: compareBigDecimals.png, v1.patch, v2.patch
>
>
> Moving the conversation from https://issues.apache.org/jira/browse/OFBIZ-6291 to this issue.
> compareBigDecimals scales down and rounds up meaning you lose information and the comparison result is not as expected



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)