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

Correct. javascript does not retain the precision

Grahame


On Wed, Aug 5, 2015 at 6:53 AM, Andy Stechishin <andy.stechishin@gmail.com>
wrote:

> James,
>
> Am I correct in thinking that Javascript does employ a library to do JSON,
> it is part of the language and as such, would not retain precision using
> the current format unless someone wrote a special library to parse the JSON
> we generate?
>
> Andy
>
> On Tue, Aug 4, 2015 at 2:24 PM, James Agnew <jamesagnew@gmail.com> wrote:
>
>> 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
>>>>
>>>
>>>
>>
>> ***********************************************************************************
>> 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=andy.stechishin@gmail.com&list=its>
>> | Terms of use
>> <http://www.HL7.org/myhl7/managelistservs.cfm?ref=nav#listrules>
>>
>
>
> ***********************************************************************************
> 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=grahame@healthintersections.com.au&list=its>
> | Terms of use
> <http://www.HL7.org/myhl7/managelistservs.cfm?ref=nav#listrules>
>



-- 
-----
http://www.healthintersections.com.au / grahame@healthintersections.com.au
/ +61 411 867 065

Received on Tuesday, 4 August 2015 21:02:52 UTC