- From: Andy Seaborne <andy.seaborne@epimorphics.com>
- Date: Thu, 04 Apr 2013 14:50:46 +0100
- To: public-rdf-wg@w3.org
On 04/04/13 14:34, Markus Lanthaler wrote: > On Thursday, April 04, 2013 2:58 PM, Andy Seaborne wrote: > >> Minor: >> >> "1.99999999999999999999"^^xs:double isn't a double or at least not the >> double you may think it is . It is outside the precision range for >> doubles which is 53 bits. As JSON uses doubles, effectively, they do >> roughy align on xs:double. >> >> http://www.w3.org/TR/xmlschema11-2/#double > > That's true, at least for JavaScript which (in the current version) > internally uses 64 bit floating point numbers. > > >> A decimal is arbitrary precision in XSD: >> >> "1.99999999999999999999"^^xs:decimal >> >> Decimals minimum precision is 18 digits. >> >> and also >> http://www.w3.org/TR/xsd-precisionDecimal/ > > That's why we don't convert decimals at all.. They will remain strings in > the form > > { > "@value": "1.99999999999999999999", > "@type": "xs:decimal" > } > > >>> Should these be forced to >>> remain in expanded form, to avoid this changing of value and even >> type? >>> On this, I suggest expanded form be required if practical -- but I'm >> not >>> sure it's always clear when it's required. >>> >>> These basically boil down to what kind of fidelity is to be >> guaranteed >>> by round-tripping RDF->JSONLD->RDF. >> >> which is a very good question > > I've more or less rewritten the Data Round Tripping section [1]. I hope it > is much clearer now: > > http://json-ld.org/spec/latest/json-ld-api/#data-round-tripping > > By default, XSD integers and doubles are converted to JSON-native numbers, > which is what most developers would expect. If precision or the exact > lexical form matters, the "use native types" flag of the Convert from RDF > algorithm [2] can simply be set to false and no literals will be converted. > xsd:integers are arbitrary size - there are derived classes that have specific ranges (e.g. xsd:int is 32 bit - xsd:long at 64 bits is outside JSON numbers) Andy > > [1] > https://github.com/json-ld/json-ld.org/commit/11ea074d054acf20704f5330905194 > 3043066986 > [2] http://json-ld.org/spec/latest/json-ld-api/#convert-from-rdf-algorithm > > > > -- > Markus Lanthaler > @markuslanthaler > >
Received on Thursday, 4 April 2013 13:51:21 UTC