W3C home > Mailing lists > Public > public-qt-comments@w3.org > September 2003

RE: Overflow during computation of arithmetic functions

From: Michael Brundage <xquery@comcast.net>
Date: Fri, 26 Sep 2003 10:04:37 -0700
To: "'Kay, Michael'" <Michael.Kay@softwareag.com>, <public-qt-comments@w3.org>
Message-ID: <001501c38450$444fdac0$6501a8c0@xpider>
I'm asking about builtin functions like avg().  6.2 just addresses the
built-in operators like +, and nothing in the standard says that fn:sum()
uses the same semantics as op:add().  (Although avg() is defined to be sum()
div count().)
Also, I'm asking whether overflow occurs, not how the implementation is
required to handle it when it does.
On an implementation that chooses limited precision, is ($max_int +
$max_int)/2 allowed to return $max_int or must it overflow?  If 6.2 answers
this, it's not obvious.
It's ok, it's not an important question.
-----Original Message-----
From: public-qt-comments-request@w3.org
[mailto:public-qt-comments-request@w3.org] On Behalf Of Kay, Michael
Sent: Friday, September 26, 2003 7:01 AM
To: Michael Brundage; public-qt-comments@w3.org
Subject: RE: Overflow during computation of arithmetic functions

> How is overflow to be handled during the computation of 
> arithmetic functions? 

This is explained in section 6.2 of the Functions & Operators specification.

Michael Kay 

> For example, on implementations that choose to limit the 
> precision of xs:integer to (signed) 64 bit integers, should 
> let $max_int := xs:integer("9223372036854775807") 
> return avg(($max_int, $max_int)) 
> succeed and return $max_int, fail with overflow, or is the 
> behavior implementation-dependent/defined? 
> Michael Brundage 
> xquery@comcast.net 
> Writing as 
> Author, "XQuery: The XML Query Language" (Addison-Wesley, to 
> appear 2003) Co-author, "Professional XML Databases" (Wrox 
> Press, 2000) 
> not as 
> Technical Lead 
> Common Query Runtime/XML Query Processing 
> WebData XML Team 
> Microsoft 
Received on Friday, 26 September 2003 12:58:19 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:56:49 UTC