W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > October to December 2005

Re: Question concerning typed literals in SPARQL

From: Steve Harris <S.W.Harris@ecs.soton.ac.uk>
Date: Mon, 5 Dec 2005 14:00:44 +0000
To: public-rdf-dawg@w3.org
Message-ID: <20051205140044.GB10241@login.ecs.soton.ac.uk>

On Mon, Dec 05, 2005 at 05:48:31AM -0500, Eric Prud'hommeaux wrote:
> > However,
> > 
> > SELECT  ?s, ?p
> > WHERE   { ?s, ?p, ?o .
> >            FILTER (?o = 1.3e0) . } .
> > 
> > would match the following triples
> > 
> > <eg:decimal> <eg:p> "1.3"^^xsd:decimal .
> > <eg:double> <eg:p> "1.3"^^xsd:double .
> > <eg:decimal2> <eg:p> "1.300"^^xsd:decimal .
> 
> @FLOAT@
> 
> > 
> > because the numeric rules would cast "1.3"^^xsd:float to the nearest 
> > double, which is not "1.3"^^xsd:double.
> 
> I've been scratching my head about this for a while.
> Is this a last-bit-might-be-wrong problem, or something more related
> to type promotion voodoo?

I think its type promotion voodoo, "1.3"^^xsd:float is 1.29999...
internally, which when cast to double is 1.29999... Working out equality
for floating poiunt numbers is hard at the best of times, with promotion
it becomes extra tricky.

- Steve
Received on Monday, 5 December 2005 14:00:56 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:25 GMT