Re: Question concerning typed literals in SPARQL

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 UTC