user3024902
user3024902

Reputation: 213

What are the limits of the decimal type in XML Schema (XSD)?

What are the minimum and maximum acceptable values of the decimal type in XML Schema? (type="xs:decimal")?

Upvotes: 3

Views: 9527

Answers (1)

kjhughes
kjhughes

Reputation: 111491

XML Schema itself does not impose minimum and maximum values on xsd:decimal:

[Definition:] decimal represents arbitrary precision decimal numbers. The ·value space· of decimal is the set of the values i × 10^-n, where i and n are integers such that n >= 0.

[Contrast this with xsd:float, which corresponds to IEEE single-precision 32-bit floats.]

Implementations, on the other hand, may support limits to the range of xsd:decimal:

NOTE: All ·minimally conforming· processors ·must· support decimal numbers with a minimum of 18 decimal digits (i.e., with a ·totalDigits· of 18). However, ·minimally conforming· processors ·may· set an application-defined limit on the maximum number of decimal digits they are prepared to support, in which case that application-defined maximum number ·must· be clearly documented.

[For example, Xerces2-J uses java.math.BigDecimal; see How to get biggest BigDecimal value for answers on how big BigDecimal can be.]

Upvotes: 5

Related Questions