OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

odata message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: [OASIS Issue Tracker] (ODATA-771) Exponential notation for Edm.Decimal values in JSON payloads


    [ https://issues.oasis-open.org/browse/ODATA-771?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=58141#comment-58141 ] 

Evan Ireland commented on ODATA-771:
------------------------------------

The CSDL spec states:

  A decimal property MAY define a non-negative integer value or variable for the Scale attribute. 
  This attribute specifies the maximum number of digits allowed to the right of the decimal point.
  The value variable means that the number of digits to the right of the decimal point may vary from
  zero to the value of the Precision attribute.

  The value of the Scale attribute MUST be less than or equal to the value of the Precision attribute.
  
Now this issue description states:

  "The correct, lossless representation of DECFLOAT values is an Edm.Decimal with unspecified precision and variable scale."

There are some problems with this issue description:

1. IEEE DECFLOAT can have precision of 16 or 34 (for the 64/128 bit variants). But its scale can be negative or positive (exponent range: -383..384 or -8143..8144).

   The scale of a DECFLOAT can be far larger than the precision (not allowed by CSDL).
   
   The scale of a DECFLOAT can be negative (not allowed by CSDL).
   
2. What is the scale of a value specified in exponential notation? For example:

   12.3456e2 (= 1234.56 in non-exponential notation)
   
   Is the scale of 12.3456e2 equal to 4 (the number of digits right of the decimal point)
   or is it 2 (the number of digits right of the decimal point in non-exponential form).

3. Are trailing zeroes (before an exponent) meaningful?

   12.34560e2
   
   is it equivalent to 1234.56 (scale = 2)
   
   or is it equivalent to 1234.560 (scale = 3)

4. When Precision is unspecified and Scale is variable in CSDL, it is reasonably implied that
   a runtime decimal value can have arbitrary Precision and Scale, so long as the Scale of the
   value is less than or equal to the Precision of the value. But DECFLOAT exponential
   representation supports values which do not meet that constraint.

Perhaps DECFLOAT should be a separate CSDL data type.


> Exponential notation for Edm.Decimal values in JSON payloads
> ------------------------------------------------------------
>
>                 Key: ODATA-771
>                 URL: https://issues.oasis-open.org/browse/ODATA-771
>             Project: OASIS Open Data Protocol (OData) TC
>          Issue Type: Improvement
>          Components: OData JSON Format
>    Affects Versions: V4.0_ERRATA02
>         Environment: [Proposed]
>            Reporter: Ralf Handl
>             Fix For: V4.0_ERRATA03
>
>
> IEEE754 defines the DECFLOAT data type for high-precision decimal arithmetic. They have 16 or 34 decimal digit mantissas and exponents between -383 and +384 or -6143 and +6144.
> The correct, lossless representation of DECFLOAT values is an Edm.Decimal with unspecified precision and variable scale.
> The OData JSON Format represents Edm.Decimal values as JSON numbers, and JSON numbers allow exponential notation, so 
> "VeryLittle":1.4e-6143
> should be valid in JSON payloads.



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