XML Schema 1.1 [1] introduces a new primitive datatype called

The new type is independent of

More information about the

This memo explores the impact of the new

(1) We will need to define where

(a) Any function that expects a

(b) Any function that expects a

(2) We will need to define the rules for how

(3) In F&O, we will need to define the semantics of the following
arithmetic functions on the

Part of this definition will involve specifying the precision of the result, based on the precision of the operands. Presumably this can be done by reference to the forthcoming IEEE 754r standard. In general, the precision of the result of a decimal operation is at least as great as the greater of the precisions of its operands. For example, if (1000 with precision -3) is added to (.001 with precision 3), the result is (1000.001 with precision 3). Each operator (addition, multiplication, etc.) defines its own precision rules. It is also necessary to deal with many special cases (what is the result of -INF modulus negative zero, etc.) Again, this can be done by reference to IEEE 754r.

One important case deals with arithmetic between a

An expert on XQuery Functions and Operators should read the draft 754r standard carefully. It contains some surprises, which apply to both binary and decimal formats, such as the following:

In 754r Section 5.10 we read "totalorder(-NaN, number) is true where -NaN represents a NaN with negative sign bit". (But there is no negative NaN value in XML Schema.)

In 754r Section 6.2 we read "Two different kinds of NaN, signaling and quiet, shall be supported in all operations." (This concept also does not exist in XML Schema. Possibly the distinction between signalling and quiet NaN's can be ignored in XPath/XQuery.)

(4) In F&O, we will need to define the behavior of the following
comparison functions on the

These semantics can be based on the ordering rules for

(5) We will need to define how

(6) We will need to define how to represent a literal
`xs:precisionDecimal()`

that
accepts any valid lexical representation and applies the lexical
mapping defined by XML Schema 1.1 (example:
`xs:precisionDecimal("5.000")`

maps into a

(7) We will need to define the semantics of the following numeric
functions for

Again, the IEEE 754r draft has something to say about these functions,
which should be considered carefully. We might also consider adding a
new function that implements the rounding mode called "Round to
Nearest, Ties Away from Zero" (defined in IEEE 754r). For aggregating
functions such as fn:max and fn:avg, we will need to give special
attention to the case where

(8) We will need to define general rules for overflow and underflow in

(9) We will need to define the casting rules for

(10) Note that the XQuery rules for SequenceType Matching respect
subtypes (for example, an

(a) If a variable is declared to have type

(b) "instance of

(c) typeswitch expressions need separate branches for

(d) "treat as

(e) In a path expression, the node-test ```
element(*,
xs:decimal)
```

will not match an element of type

(11) We will need to define rules for the minimum

References
[1]
World Wide Web Consortium (W3C).
2006 .
XML
Schema 1.1 Part 2: Datatypes , ed.
David Peterson ,
Paul V. Biron ,
Ashok Malhotra ,
and
C. M. Sperberg-McQueen .
W3C Working Draft 17 February 2006
[Cambridge, Sophia-Antipolis, and Tokyo]: World Wide Web Consortium.
http://www.w3.org/TR/xmlschema11-2/
[2]
IEEE (Institute of Electrical and Electronics Engineers).
2001-2007 .
Draft Standard for Floating-Point Arithmetic P754 .
Various drafts, 2001-2007.
At the time of publication, the most recent drafts, reflecting the
resolution of ballot comments, are not publicly available. See
http://754r.ucbtest.org/drafts/archive/ for an archive of
older committee drafts.
[3]
Cowlishaw, Michael.
2007 .
Decimal Arithmetic FAQ
(Frequently Asked Questions) .
21 April 2007.
On the Web at
http://www2.hursley.ibm.com/decimal/decifaq.html .