XML 模式中十进制类型的最小和最大可接受值是多少? (type="xs:decimal"
)?
最佳答案
XML 模式本身并不对 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.
[将此与 xsd:float
进行对比,对应 IEEE 单精度 32 位 float 。]
另一方面,实现可能支持对 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.
[例如,Xerces2-J uses java.math.BigDecimal
;请参阅How to get biggest BigDecimal关于 BigDecimal 可以有多大的答案的值。]
关于xml - XML 架构 (XSD) 中十进制类型的限制是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26909331/