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

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

From: Mary Holstege <mary@cerisent.com>
Date: Sun, 15 Feb 2004 11:34:34 -0800
Message-ID: <16431.51658.520000.573343@gargle.gargle.HOWL>
To: public-qt-comments@w3.org

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

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 Tuesday, 17 February 2004 11:10:56 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:17 UTC