[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 edited comment on ODATA-784 at 10/11/15 2:57 PM: -------------------------------------------------------------- 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 (but not a specific scale) use the rule: scaleof(A div B) = scaleof(A) This seems a reasonable resolution. Alternatively (if others believe this is too prescriptive): scale(A div B) >= scale(A) was (Author: evan.ireland.2): 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 (but not a specific scale) use the rule: scale(A div B) = scale(A) This seems a reasonable resolution. Alternatively (if others believe this is too prescriptive): scale(A div B) >= scale(A) > 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]