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

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