什么是第二个最低值,小数可以重新present? [英] What's the second minimum value that a decimal can represent?
问题描述
什么是第二个最低的价值,一个十进制
可以重新present?这是比 Decimal.MinValue
不是一个十进制
可以重新$ P任何其他价值较大和较小的值$ psent。我怎样才能获得在C#中这个值?谢谢!
What's the second minimum value that a decimal
can represent? That is the value which is larger than Decimal.MinValue
and smaller than any other values that a decimal
can represent. How can I obtain this value in C#? Thanks!
推荐答案
第二小值 Decimal.MinValue + 1
。
这可以从文档中推断十进制
:
一个十进制数是由一个符号的一个浮点值,一 数字值,其中在所述值的每个数字范围从0到9,和一个 缩放因子,指示浮动小数点的位置 分隔数值的整数和小数部分。
A decimal number is a floating-point value that consists of a sign, a numeric value where each digit in the value ranges from 0 to 9, and a scaling factor that indicates the position of a floating decimal point that separates the integral and fractional parts of the numeric value.
十进制值的二进制重新presentation由1位标志, 一个96位整数,用来划分的比例因子 96位整数,并指定哪些它部分是一个小数。 缩放因子是隐含数目为10,升温至指数 范围从0到28。因此,二进制重新$ P $的psentation 十进制值是的形式,((-2 ^ 96至2 ^ 96)/ 10 ^(0〜28)),其中的 -2 ^ 96-1等于MINVALUE,和2 ^ 96-1等于MaxValue的
The binary representation of a Decimal value consists of a 1-bit sign, a 96-bit integer number, and a scaling factor used to divide the 96-bit integer and specify what portion of it is a decimal fraction. The scaling factor is implicitly the number 10, raised to an exponent ranging from 0 to 28. Therefore, the binary representation of a Decimal value is of the form, ((-2^96 to 2^96) / 10^(0 to 28)), where -2^96-1 is equal to MinValue, and 2^96-1 is equal to MaxValue.
从上面我们可以推断,在合法值范围的极限边缘,比例因子是 1
(10到电源0),因此这是最小的当一个十进制值被修改量子。
From the above we can infer that on the extreme edges of the legal value range, the scaling factor is 1
(10 to the power 0) and therefore that's the smallest quantum when a decimal value is modified.
Live proof.
这篇关于什么是第二个最低值,小数可以重新present?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!