From: Ashok Malhotra <ashokma@microsoft.com>

Date: Mon, 5 May 2003 15:23:34 -0700

Message-ID: <E5B814702B65CB4DA51644580E4853FB081B99D0@red-msg-12.redmond.corp.microsoft.com>

To: "Jeff Kenton" <jkenton@datapower.com>, <public-qt-comments@w3.org>

Date: Mon, 5 May 2003 15:23:34 -0700

Message-ID: <E5B814702B65CB4DA51644580E4853FB081B99D0@red-msg-12.redmond.corp.microsoft.com>

To: "Jeff Kenton" <jkenton@datapower.com>, <public-qt-comments@w3.org>

Please look at the latest Functions and Operators document at http://www.w3.org/TR/xpath-functions/ This answers many of your questions but see also below. All the best, Ashok > -----Original Message----- > From: public-qt-comments-request@w3.org [mailto:public-qt-comments- > request@w3.org] On Behalf Of Jeff Kenton > Sent: Monday, May 05, 2003 11:17 AM > 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? [AM] Yes, but if you do it that way its is possible to represent only 16 decimal digits. See http://lists.w3.org/Archives/Member/w3c-xml-schema-ig/2002Jun/0077.html 18 digits of precision = 60 binary bits (log2(10^18)) sign = 1 bit scale = 5 bits (to represent 0-18) This needs 66 bits! 16 digits of decimal precision can be accommodated in 64 bits. > > 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 [AM] The document says: "The number of digits of precision returned by various numeric functions is *implementation dependent*." > > 2. For decimal multiplication, with a minimal representation supporting a > fixed number of total digits, are there provisions for overflow or > underflow? [AM] Yes, the latest document spells these out. > > 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? [AM] There is nothing explicitly defined for decimal arithmetic. The above quote would apply. In practice, most implementations will use standard decimal libraries and the behavior will be as implemented in the libraries. > > 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? [AM] See above. > > 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. [AM] We define over/underflow behavior. There are no NaNs and infinities in decimal arithmetic. > > > 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 18:23:50 GMT

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