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

Questions about XPath 2.0 decimal arithmetic

From: Jeff Kenton <jkenton@datapower.com>
Date: Mon, 05 May 2003 14:17:01 -0400
Message-ID: <3EB6AA9D.7040303@datapower.com>
To: public-qt-comments@w3.org


Greeting,

I have questions about arithmetic operations on decimal numbers.  It seems to me that the Working Draft and related documents lack the detail required.  Some of my questions relate to any implementation, and some have to do with boundary conditions that will arise for particular implementations:

0. A "minimally conforming" processor must support decimal numbers with a minimum of 18 total digits.  Is it adequate to represent this as a 64-bit integer plus a scale factor?

1. For decimal multiplication, how are the number of fraction digits in the result calculated? The obvious answer (to me) is the total of fraction digits in both operands, but this is nowhere specified.  Example: 1.2*2.4 = 2.88

2. For decimal multiplication, with a minimal representation supporting a fixed number of total digits, are there provisions for overflow or underflow?

3. For decimal multiplication, with a minimal representation supporting a fixed number of total digits, are there provisions for rounding when the total number of digits in the exact answer exceed what the representation supports? Note that a similar question applies to datatypes derived from decimal which have a limited number of fraction digits.

Example:  123456789.123456789*987654321.987654321 = 121932631356500531.347203169112635269
                 do we round off (drop) the fraction digits?

4. For decimal division, how are the number of fraction digits in the result calculated?

    Example:  1.0 div 3.0, is the result 0.3, or is it 0.33333333333333333?

5. For decimal division, do we have underflow, overflow, infinities, Nans? Or do certain operations result in errors? Again, a similar question applies to datatypes derived from decimal which have a limited number of digits, and perhaps to the integer types as well.


Since decimal representation is now an important part of XPath 2.0, I believe these details require attention.  I look forward to your clarifications.

Thank you,

jeff kenton

-- 

--------------------------
Jeff Kenton
DataPower Technology, Inc.
Received on Monday, 5 May 2003 14:20:03 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:14:24 GMT