W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > July 2012

Serializing xsd:decimal, xsd:float, xsd:double

From: David Booth <david@dbooth.org>
Date: Fri, 20 Jul 2012 11:19:55 -0400
To: public-rdf-dawg-comments@w3.org
Message-ID: <1342797595.3486.21722.camel@dbooth-laptop>
It is currently difficult to compare the results of two different SPARQL
servers when xsd:decimal, xsd:float or xsd:double are used, because
there does not seem to be any standard way to control the number of
decimal places that are serialized.  For example, if the decimal
0.049508196721311475409836 is computed, one server may serialize this as


and another may serialize it as


One might (erroneously) attempt to round both of the serialized values
to one decimal place in order to compare them, but if they have already
been rounded once before serialization (as above) then this won't work,
because 0.050 rounds to 0.1, while 0.0495081967 rounds to 0.0.

I think the SPARQL standard should provide some "SHOULD" guidance, such
as specifying that a SPARLQ server SHOULD (by default) serialize a
specified number of decimal places (perhaps all available), and MAY
provide a standard means of controlling the number of decimal places
that are serialized.

If it is too late in the WG process to consider this for SPARQL 1.1 (and
I assume it is) then please add this to the wish list for the next


David Booth, Ph.D.

Opinions expressed herein are those of the author and do not necessarily
reflect those of his employer.
Received on Friday, 20 July 2012 15:20:23 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:01:30 UTC