gpt4 book ai didi

c++ - 十进制、 double 、整数等数据类型的范围?

转载 作者:行者123 更新时间:2023-11-28 00:16:59 24 4
gpt4 key购买 nike

XML 和 RDF 数据具有某些数据类型,如十进制、 double 和整数 (http://www.w3.org/TR/1999/WD-xmlschema-2-19991217/#decimal)。这些数据类型的范围是什么。

我知道 C++ 中十进制、 double 、整数的范围在 https://msdn.microsoft.com/en-us/library/s3f49ktz.aspx 中给出。 . XML 和 RDF 数据类型是否具有相同的范围或者是它们的范围。如果它们的范围不同,那么它们的实际范围是多少?

最佳答案

xs:double 和 xs:float 由 IEEE 规则定义。见

3.3.5 double

The ·value space· of double contains the non-zero numbers m × 2e , where m is an integer whose absolute value is less than 253, and e is an integer between −1074 and 971, inclusive.

相比之下,xs:integer 和 xs:decimal 的限制是实现定义的。

Section 3.3.3: [Definition:] decimal represents a subset of the real numbers, which can be represented by decimal numerals. The ·value space· of decimal is the set of numbers that can be obtained by dividing an integer by a non-negative power of ten, i.e., expressible as i / 10n where i and n are integers and n ≥ 0.

Section 5.4: All ·minimally conforming· processors must support decimal values whose absolute value can be expressed as i / 10^k, where i and k are nonnegative integers such that i < 1016 and k ≤ 16 (i.e., those expressible with sixteen total digits).

关于c++ - 十进制、 double 、整数等数据类型的范围?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29582645/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com