[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=15335722#comment-15335722 ]

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

Thanks Jacques for the detailed input. What I see from Java API documentation, it seems to me that this particular abstraction won't be compromised if we apply this patch. It states that BigDecimal.compareTo() method treats two objects with different scale as equal (2.0 == 2.00), while BigDecimal.equals() do not. I am not sure why Adrian quoted that but seems like we shouldn't be facing any issue, and as you said, crossing my fingers already :).

Here is the link to java docs https://docs.oracle.com/javase/8/docs/api/java/math/BigDecimal.html#compareTo-java.math.BigDecimal-

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