[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: [OASIS Issue Tracker] (ODATA-784) Need to specify the behaviour of arithmetic operators on Decimal type
[ https://issues.oasis-open.org/browse/ODATA-784?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61040#comment-61040 ] Evan Ireland commented on ODATA-784: ------------------------------------ The Java preferred division scale is only for *exact* division with divide(BigDecimal divisor) Returns a BigDecimal whose value is (this / divisor), and whose preferred scale is (this.scale() - divisor.scale()); if the exact quotient cannot be represented (because it has a non-terminating decimal expansion) an ArithmeticException is thrown. The BigDecimal methods that accept a rounding mode use the rule: scale(A div B) = scale(A) (which is greater than scale(A) - scale(B)) Consider also the following: X / 2.0 is equivalent to X * 0.5 for which we would apply the rule scaleof(A mul B) = scaleof(A) + scaleof(B). So sticking with scaleof(A mul B) = scaleof(A) + scaleof(B) seems the most reasonable. > Need to specify the behaviour of arithmetic operators on Decimal type > --------------------------------------------------------------------- > > Key: ODATA-784 > URL: https://issues.oasis-open.org/browse/ODATA-784 > Project: OASIS Open Data Protocol (OData) TC > Issue Type: Improvement > Components: OData URL Conventions > Affects Versions: V4.0_OS > Environment: Proposed > Reporter: Evan Ireland > Priority: Minor > Fix For: V4.01_WD01, V4.0_ERRATA03 > > > The rules for scale of results of decimal arithmetic operators are not specified. -- This message was sent by Atlassian JIRA (v6.2.2#6258)
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]