- From: Andy Seaborne <andy.seaborne@epimorphics.com>
- Date: Tue, 28 Feb 2012 20:30:58 +0000
- To: public-rdf-comments@w3.org
On 28/02/12 19:38, Alex Hall wrote: > On Tue, Feb 28, 2012 at 2:04 PM, Henry Story <henry.story@bblfish.net > <mailto:henry.story@bblfish.net>> wrote: > > I just found that the test suite is assuming there is a maximum > precision for xsd:decimals > > In these test suites > > http://www.w3.org/TR/turtle/tests/test-28.ttl > http://www.w3.org/TR/turtle/tests/test-28.out > > we can find that after a number of 00s the numbers are suddenly > simplified > > "2.234000000000005"^^<http://www.w3.org/2001/XMLSchema#decimal> . > "2.2340000000000005"^^<http://www.w3.org/2001/XMLSchema#decimal> . > "2.234"^^<http://www.w3.org/2001/XMLSchema#decimal> . > "2.234"^^<http://www.w3.org/2001/XMLSchema#decimal> . > > I could not find in the xsd spec anything about this, neither in the > rdf semantics specification. Is this an error, or is this a byproduct > of a specific implementation? > > > xsd:float and xsd:double are modeled after IEEE 32 and 64-bit floating > point numbers, so they do have a maximum precision. Perhaps one of these > was intended? I think Henry's right. XSD has a minimum required precision (significant digits) of 18. These number flip around 18 significant digits. It's nothing to do with Turtle. Hmm - drift - this has changed in XMLschema 1.1. ## XMLSchema 1 http://www.w3.org/TR/xmlschema-2/ 3.2.3 decimal All ·minimally conforming· processors ·must· support decimal numbers with a minimum of 18 decimal digits ## XMLSchema 1.1 http://www.w3.org/TR/xmlschema11-2/#partial-implementation All ·minimally conforming· processors must support decimal values whose absolute value can be expressed as i / 10k, where i and k are nonnegative integers such that i < 1016 and k ≤ 16 (i.e., those expressible with sixteen total digits). which is IEEE 857 Decimal64 (if I read the page on Wikipedia correctly) > Regardless of the specific datatype, I don't think these cases involving > precision of floating-point numbers belong as part of the Turtle test > suite. The Turtle specification says nothing about interpretation of > datatypes, XSD or otherwise, nor about canonicalization of the lexical > form. The tests should only concern themselves with issues of Turtle > syntax, and precision of xsd:float/double values is well outside the > scope of that. +1 > After all, "dog"^^xsd:integer is a perfectly valid RDF literal and > should be allowed in a Turtle file. It's not until you get into issues > of datatype interpretation that you care whether "dog" is a valid integer. > > Regards, > Alex > > > > Henry > Andy > > http://www.w3.org/TR/xsd-precisionDecimal/#precisionDecimal > Social Web Architect > http://bblfish.net/ > > >
Received on Tuesday, 28 February 2012 20:31:25 UTC