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

RE: [F&O] CER-11 xs:decimal overflow

From: Ashok Malhotra <ashokma@microsoft.com>
Date: Sun, 28 Mar 2004 15:42:21 -0800
Message-ID: <EDB607C8AC991F40BE646533A1A673E801A586AD@RED-MSG-42.redmond.corp.microsoft.com>
To: <mary@cerisent.com>, <public-qt-comments@w3.org>

Mary:
You said...

> Solution: Overflow/underflow should happen only for numbers exceeding
the
> implementation's xs:decimal range, not for precision-related
roundings.

The statement in 6.2 is general, not specific to any function.  Your
statement above is correct but I'm not sure what needs to be changed.
If wording can be improved, please make a suggestion.

All the best, Ashok

-----Original Message-----
From: public-qt-comments-request@w3.org
[mailto:public-qt-comments-request@w3.org] On Behalf Of Mary Holstege
Sent: Sunday, February 15, 2004 11:35 AM
To: public-qt-comments@w3.org
Subject: [F&O] CER-11 xs:decimal overflow


F&O [6.2] xs:decimal overflow should not happen on rounding

As currently written the expression "1 div 3 * 100" causes a mandatory
overflow
error. 

Per F&O 6.2:
   "For xs:decimal operations, overflow behavior *must* raise an error
[numeric
   operation overflow/underflow]. On underflow, 0.0 must be returned." 

Per F&O 6.2.4:
   "As a special case, if the types of both $arg1 and $arg2 are
xs:integer,
   then the return type is xs:decimal." 

So 1 and 3 are typed as xs:integer and their division results in an
xs:decimal
which cannot be precisely represented, causing an overflow error.  This
should
not happen.   

(Note that depending on your reading of the spec, the simple division
may not be
an "xs:decimal" operation, but the "* 100" clearly makes it an
xs:decimal
operation which will cause an overflow error.)

Solution: Overflow/underflow should happen only for numbers exceeding
the
implementation's xs:decimal range, not for precision-related roundings. 

This is especially onerous given that such errors cannot be caught and
handled
by the XQuery application; see CER-05.
Received on Sunday, 28 March 2004 18:46:26 UTC

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