[
https://issues.apache.org/jira/browse/OFBIZ-6386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14550061#comment-14550061
]
Gareth Carter commented on OFBIZ-6386:
--------------------------------------
It may not perform calculations directly but it is a control statement in
minilang, therefore calculations (or other code) may occur that were not
expected.
I only analysed ofbiz for usage not impact. I noticed the accounting component
used <if-compare and <if-compare-field with type="BigDecimal" and with
accounting you generally want accuracy in terms of numbers, BigDecimal offers
this
but, to me compareBigDecimals does not. You lose information on comparison.
Java code in ofbiz generally uses compareTo for comparison without modifying
scale.
Groovy code is the same as java (using compareTo), groovy also supports
operator overloading which will use compareTo for relational operator
overloading (eg, a == b)
The compareBigDecimals method used in minilang behaves slightly different to
those comparisons done in java or groovy but only for values like those in
compareBigDecimals.png
I will provide a patch for review as soon as I can
> 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
> Priority: Minor
> Attachments: compareBigDecimals.png
>
>
> 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)