问题描述
是真的,浮点数越大(正数或负数),我们对位数进行十进制数字编码的越少?
我们可以编码在2 和2 之间比在2 和2 ? b
$ b
这两个范围之间的值是否相同?
换句话说,浮点数只有一个固定的位数,可以用一个浮点数来表示。 ,随着数字越来越大,这些manitssa数字将在小数点后面减少(这是我想要的)。
替代方案是固定点数字,其中小数点后的数字位数是常数。但是不是很多系统使用固定点数,所以如果这是你想要的,你必须滚动自己的,或使用第三方库。
Is it true that the more the floating point number is big (either positive or negative) the less we have bits to encode the decimal digits?
Can we encode more decimal digits between 2 and 2 than between 2 and 2?
Is there the same count of values between this two ranges?
Yes the density of numbers that are exactly representable by a floating point number gets smaller as the numbers get bigger.
Put it another way, floating point numbers only have a fixed number of bits for the mantissa and as the numbers get bigger, fewer of those manitssa digits will be after the decimal point (which is what I think you were asking).
The alternative would be fixed point numbers where the number of digits after the decimal point is constant. But not many systems use fixed point numbers, so if that's what you want you have to roll your own, or use a third party library.
这篇关于浮点数密度 - 数字的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!