W3C home > Mailing lists > Public > public-qt-comments@w3.org > August 2006

[Bug 3615] [F&O] Precision in fn:avg()

From: <bugzilla@wiggum.w3.org>
Date: Tue, 22 Aug 2006 17:41:55 +0000
CC:
To: public-qt-comments@w3.org
Message-Id: <E1GFaGB-0002SN-ED@wiggum.w3.org>

http://www.w3.org/Bugs/Public/show_bug.cgi?id=3615

           Summary: [F&O] Precision in fn:avg()
           Product: XPath / XQuery / XSLT
           Version: Candidate Recommendation
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Functions and Operators
        AssignedTo: ashok.malhotra@oracle.com
        ReportedBy: jsnelson@sleepycat.com
         QAContact: public-qt-comments@w3.org


The specification for fn:avg() includes the line:

    Otherwise, returns the average of the values computed as sum($arg) div
    count($arg).

Whilst this is a useful description of the results required from the function,
it could also be seen as being perscriptive of how the function must be
implemented. One consequence of this can be seen in the XQTS test
fn-avgflt2args-1, with a discussion about it in bug #3610.

To summerise, the test query is:

fn:avg((xs:float("-3.4028235E38"),xs:float("-3.4028235E38")))

and the test expects a result of "-INF", since "-3.4028235E38" is the lower
bound for an xs:float and the fn:sum() operation will underflow. However, I
think it is entirely reasonable to implement fn:avg() in such a way as to
return the answer "-3.4028235E38" for this query, which is both a valid
xs:float and the correct mathematical result.

I propose that the sentance above from the F&O specification be changed to the
following:

    Otherwise returns the average of the values, computed as sum($arg) div
    count($arg) or otherwise.
Received on Tuesday, 22 August 2006 17:42:02 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:14:44 GMT