W3C home > Mailing lists > Public > public-qt-comments@w3.org > March 2004

RE: NM-F&O-8: fn:sum, fn:min, fn:max

From: Ashok Malhotra <ashokma@microsoft.com>
Date: Wed, 24 Mar 2004 08:34:40 -0800
Message-ID: <EDB607C8AC991F40BE646533A1A673E8019B7E20@RED-MSG-42.redmond.corp.microsoft.com>
To: "Noe Michejda" <noe_michejda@7thportal.pl>, <public-qt-comments@w3.org>
Noe:

Thank you for your editorial suggestions.  We shall take them into
consideration for the next version of the document.

All the best, Ashok 

________________________________

From: public-qt-comments-request@w3.org
[mailto:public-qt-comments-request@w3.org] On Behalf Of Noe Michejda
Sent: Tuesday, February 24, 2004 4:04 PM
To: public-qt-comments@w3.org
Subject: NM-F&O-8: fn:sum, fn:min, fn:max

 

I think it's editorial error:

 

If input sequence is not empty, doesn't contains NaN's and error is not
raised,
the result of the function is defined as result of the expression:

$c[1] + fn:sum(subsequence($c, 2))

So in last recursion, when count($c)=1, fn:sum is called again with
empty sequence as parameter
and returns 0.0e0 of type double. When sequence contains values of types
other than numeric (dayTimeDuration etc),
addition will raise type error. According to this fn:sum will not work
for sequence of any types other than numeric...

Also this expression should be defined for two-argument version of
fn:sum and say that second argument is assumend 0.0e0
if not specified. It should be:


if (count($c)=1)
    $c[1]
else
    $c[1] + fn:sum(subsequence($c, 2),$zero)




Similar definitions in fn:min and fn:max are not clear:
"If the items in the value of $arg are of type xs:string or types
derived by restriction from xs:string, then the determination of the
greatest item is made according to the collation that is used."

"according to the collation" is not precise, expression with fn:compare
should be used.

Plus there are two typos in expressions used for general case: ')' on
end of first line and ']' on end of third

and variable $collation mentioned below expression is not used.

 

Best Regards,

Noe Michejda

7th Portal S.C.

 

 
Received on Wednesday, 24 March 2004 17:13:26 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:13:56 UTC