Re: avg testcase issues (was: Re: syntax error in testcase manifest)

On 18/05/11 03:27, Steve Harris wrote:
> In response to http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/2011Feb/0025.html
>
>   >  I do have some issues to report with two testcases, both dealing with
>   >  the AVG operator.
>   >
>   >  Before I go into that: I have assumed that when the definition of AVG
>   >  (http://www.w3.org/TR/sparql11-query/#setFunctions) uses the '/'
>   >  division operator, this means it applies XPath's op:numeric-divide (as
>   >  defined in section 16.3). It would actually be good to clarify this in
>   >  the spec, I think (one way to do this would be to explicitly use
>   >  op:numeric-divide in the definition, rather than just '/').
>   >
>   >  Anyway, here goes:
>   >
>   >  1. testcase aggregates/agg-avg-01 ("AVG")
>   >
>   >  This testcase currently assumes a particular precision in xsd:decimal
>   >  division, which is not mandated by the XPath definition. XPath defines
>   >  that in xsd:decimal operations, rounding is implementation dependent
>   >  (see http://www.w3.org/TR/xpath-functions/#op.numeric, near the end of
>   >  the section).
>
> I'm not sure that was the intention:
>
> "For xs:decimal values the number of digits of precision returned by the
> numeric operators is ·implementation-defined·. If the number of digits
> in the result exceeds the number of digits that the implementation
> supports, the result is truncated or rounded in an ·implementation-defined·
> manner."
>
> The minimum number of decimal places that must be supported my minimally
> conforming implementations is 18, so I don't think it's correct to round
> to one decimal place.

I must have missed the part of the spec where that is stated, but I'll 
take your word for it.

>   >  To fix this, I would suggest that the testcase numbers are adapted so
>   >  that the result of the division when not rounded is of the same
>   >  precision as the input. Alternatively, change the test case to work on
>   >  floats or doubles, as division behavior is more precisely defined for
>   >  those datatypes.
>   >
>   >  2. testcase aggregates/agg-avg-02 ("AVG with GROUP BY")
>   >
>   >  This testcase contains a typing error: the result of the AVG computation
>   >  where ?s = ex:ints should be of type xsd:decimal, not xsd:integer (XPath
>   >  defines the result of a op:numeric-divide on two integer arguments as
>   >  always being of type xsd:decimal).
>
> I believe this is now fixed.
>
> Please respond to this mail saying whether this response satisfies your comment.

It does.

Jeen

Received on Thursday, 23 June 2011 00:35:45 UTC