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

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