Re: ACTION: Lloyd to ask James and Ewot about the underlying precision retention of xsd:decimal values

According to the spec, Json/Javascript numbers are 64 bit floats (IEEE 754)
<http://www.ecma-international.org/ecma-262/5.1/#sec-8.5>. Out of the box I
would suspect that most libraries do not preserve precision since floats
don't.

Most libraries I've worked with at least have workarounds though that let
you do whatever you want with JSON data, since the type system it uses is
so underpowered. All of the major Java libraries let you interact with
numbers as BigDecimal, which is what we do for FHIR.

Cheers,
James

On Tue, Aug 4, 2015 at 4:05 PM, Paul Knapp <pknapp@pknapp.com> wrote:

> Hi James:
>
> Should we take from this that 'standard JSON deserialization' would not be
> expected to preserve precision?
>
> Regards
> Paul
>
> Sent from my iPhone
>
> On Aug 4, 2015, at 12:51 PM, James Agnew <jamesagnew@gmail.com> wrote:
>
> Hi David,
>
> Precision is preserved in JSON as well. Needing to behave consistently
> across encodings was actually the main reason for rolling our own
> primitives.
>
> Cheers,
> James
>
> On Tue, Aug 4, 2015 at 2:29 PM, David Booth <david@dbooth.org> wrote:
>
>> Hi James,
>>
>> What about for FHIR JSON?   Would 1.200 in FHIR JSON silently become 1.2,
>> or do you also perform custom FHIR JSON parsing to retain the trailing
>> digits?
>>
>> David
>>
>> On 08/04/2015 06:00 AM, James Agnew wrote:
>>
>>> On the Java side, parsing and encoding of FHIR primitives into XML is
>>> all hand rolled, so no xs:decimal. I'm not sure what the concern is, but
>>> if there are any specific areas of concern I'm always hunting for new
>>> unit tests...
>>>
>>> James
>>>
>>> On Tue, Aug 4, 2015 at 2:15 AM, Paul A. Knapp <pknapp@pknapp.com
>>> <mailto:pknapp@pknapp.com>> wrote:
>>>
>>>     Are either the Java or C# implementations using standard xml
>>>     frameworks? Ones which would implement xs:decimal? (I think that is
>>>     the concern.)
>>>
>>>     Paul
>>>
>>>     At 08:55 PM 2015-08-03, David Booth wrote:
>>>
>>>>     Content-Transfer-Encoding: 7bit
>>>>
>>>>     Regarding the above action, and last week's discussion of
>>>>     xsd:decimal, Lloyd reports: "Java uses BigDecimal - so full
>>>>     retention of precision. C# uses decimal, which also retains
>>>>     precision."
>>>>
>>>>     David Booth
>>>>
>>>>
>>>> ***********************************************************************************
>>>>     Manage subscriptions - http://www.HL7.org/listservice
>>>>     <http://www.hl7.org/listservice>
>>>>     View archives - http://lists.HL7.org/read/?forum=its
>>>>     <http://lists.hl7.org/read/?forum=its>
>>>>     Unsubscribe -
>>>>
>>>> http://www.HL7.org/tools/unsubscribe.cfm?email=pknapp@pknapp.com&list=its
>>>>     <
>>>> http://www.hl7.org/tools/unsubscribe.cfm?email=pknapp@pknapp.com&list=its
>>>> >
>>>>
>>>>     Terms of use -
>>>>     http://www.HL7.org/myhl7/managelistservs.cfm?ref=nav#listrules
>>>>     <http://www.hl7.org/myhl7/managelistservs.cfm?ref=nav#listrules>
>>>>
>>>     __
>>>
>>>     __ *Paul Knapp
>>>     *President
>>>     Knapp Consulting Inc.
>>>     www.pknapp.com
>>>
>>>     <http://www.pknapp.com/>Tel: +1 604 987-3313
>>> <tel:%2B1%20604%20987-3313>
>>>     Fax: +1 604 987-3305 <tel:%2B1%20604%20987-3305>
>>>     Cel: +1 604 250-1915 <tel:%2B1%20604%20250-1915>
>>>     KSA: +966 56 787 0341 <tel:%2B966%2056%20787%200341>
>>>     Skype: paulknapp
>>>
>>>     HL7 International ( www.HL7.org <http://www.hl7.org/> )
>>>         Co-Chair: Implementable Technology Specifications WG; Financial
>>>     Management WG; Foundation and Technology SD.
>>>         Member: FHIR Management Group; Technical Steering Committee; US
>>>     Realm Steering Committee; Architecture Review Board
>>>     EACOE Certified Enterprise Architect www.EACOE.
>>>     <http://www.eacoe.org/> org
>>>
>>>     <http://www.eacoe.org/>The information in this communication,
>>>     including any attached documentation, is intended only for the
>>>     person or entity to which it is addressed, and may contain
>>>     confidential, personal, and/or privileged information. Any
>>>     unauthorized disclosure, copying, or taking action on the contents
>>>     is strictly prohibited. If you have received this message in error,
>>>     please contact us immediately so we may correct our records. Thank
>>> you.
>>>
>>>
>>> ***********************************************************************************
>>>     Manage your subscriptions <http://www.HL7.org/listservice> | View
>>>     the archives <http://lists.HL7.org/read/?forum=its> | Unsubscribe
>>>     <
>>> http://www.HL7.org/tools/unsubscribe.cfm?email=jamesagnew@gmail.com&list=its
>>> >
>>>     | Terms of use
>>>     <http://www.HL7.org/myhl7/managelistservs.cfm?ref=nav#listrules>
>>>
>>>
>>>
>>
>> ***********************************************************************************
>> Manage subscriptions - http://www.HL7.org/listservice
>> View archives - http://lists.HL7.org/read/?forum=its
>> Unsubscribe -
>> http://www.HL7.org/tools/unsubscribe.cfm?email=jamesagnew@gmail.com&list=its
>>
>> Terms of use -
>> http://www.HL7.org/myhl7/managelistservs.cfm?ref=nav#listrules
>>
>
>

Received on Wednesday, 5 August 2015 21:40:27 UTC