Skip to Content
XQuery, 2nd Edition
book

XQuery, 2nd Edition

by Priscilla Walmsley
December 2015
Intermediate to advanced
762 pages
19h 13m
English
O'Reilly Media, Inc.
Content preview from XQuery, 2nd Edition

Chapter 17. Working with Numbers

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 round and sum.

The Numeric Types

The four main numeric types supported in XQuery are xs:decimal, xs:integer, xs:float, and 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:positiveInteger and xs:unsignedByte. For a complete list and explanation of these built-in derived types, see Appendix B.

The xs:decimal Type

The type xs:decimal represents a signed decimal number of implementation-defined precision. Numeric literals that contain only digits and a decimal point (no letter E or e) are considered decimal numbers, with the type xs:decimal. For example, 25.5 and 25.0 are xs:decimal values.

The xs:integer Type

The type 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 or e) are considered integers, with the type xs:integer. For example, 25 is an xs:integer value.

In the type hierarchy, xs:integer is derived ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

XQuery

XQuery

Priscilla Walmsley
XSLT

XSLT

Doug Tidwell
Learning XSLT

Learning XSLT

Michael Fitzgerald

Publisher Resources

ISBN: 9781491915080Purchase bookErrata Page