浮点数密度 - 数字的大小 [英] Density of floating point number - Magnitude of the number

查看:104
本文介绍了浮点数密度 - 数字的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是真的,浮点数越大(正数或负数),我们对位数进行十进制数字编码的越少?



我们可以编码在2 1 和2 2 之间比在2 16 和2 32 ? 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 21 and 22 than between 216 and 232?

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.

这篇关于浮点数密度 - 数字的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆