[ https://issues.oasis-open.org/browse/ODATA-784?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Pizzo updated ODATA-784:
--------------------------------
Proposal:
If A and B are values of type decimal, with scales scaleof(A) and scaleof(B), then:
scaleof(A add B) = max(scaleof(A), scaleof(B))
scaleof(A sub B) = max(scaleof(A), scaleof(B))
scaleof(A mul B) = scaleof(A) + scaleof(B)
scaleof(A mod B) = max(scaleof(A), scaleof(B))
scaleof(A div B) = computed with max decimal scale; how this is reported is service defined. client can cast to force scale.
For decimal values with "floating" scale, result is decimal with floating scale.
was:
If A and B are values of type decimal, with scales scaleof(A) and scaleof(B), then:
scaleof(A add B) = max(scaleof(A), scaleof(B))
scaleof(A sub B) = max(scaleof(A), scaleof(B))
scaleof(A mul B) = scaleof(A) + scaleof(B)
scaleof(A div B) = scaleof(A)
For decimal values with "floating" scale, additional consideration (or separate rules?) may be required.
> 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)