A variety of numerical calculations can be performed using XQuery. This chapter describes the major numeric types, along with the operators and functions that act on numeric values. These include comparisons, arithmetic operations, and functions that operate on numeric values such as
The four main numeric types supported in XQuery are
xs:double. All the operations and functions that can be performed on these types of numeric values can also be performed on values whose types are restrictions of these types. This includes user-defined types that appear in a schema, as well as the built-in derived types such as
xs:unsignedByte. For a complete list and explanation of these built-in derived types, see Appendix B.
xs:decimal represents a signed decimal number of implementation-defined precision. Numeric literals that contain only digits and a decimal point (no letter
e) are considered decimal numbers, with the type
xs:decimal. For example,
xs:integer represents a signed integer. The limit on how large an
xs:integer value can be is implementation-defined. Numeric literals that contain only digits (no decimal points or the letter
e) are considered integers, with the type
xs:integer. For example,
25 is an
In the type hierarchy,
xs:integer is derived ...