指数是如何计算浮点下的子范数的 [英] How is exponent calculated for subnormals in floating point

查看:251
本文介绍了指数是如何计算浮点下的子范数的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有这样的浮点比特表示:

$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $我知道具有全零指数的浮点数称为次正规或非正规数。指数的计算方式与考虑偏差的正态浮点数不同。

那么指数是如何计算出来的呢? 指数计算方式不同。唯一的区别就是一个前导0而不是前导1(所以你的例子等于 0.0000 ... 0001 * 2 ^ -1022 而不是 1.0000 ... 0001 * 2 ^ -1022



如果您正在寻找等效的尾数和指数,只要计算尾数中的前导零并加1,从原指数中减去结果,并将结果留下的尾数(因此 0.000000101 * 2 ^ -50 会导致6 + 1,并成为 1.01 * 2 ^ -57 )。


Suppose I have the floating point bits representation like this:

0 0000000000 00000000000000000000000000000000000000000000000000001

I know that the floating point numbers with the exponent of all zeros are called subnormals or denormals. And the exponent is calculated differently than for normal floating point numbers where the bias is taken into account.

So how is exponent calcualted for subnormals?

解决方案

The exponent isn't calculated differently. The only difference subnormals have is a leading 0 instead of a leading 1 (so your example is equal to 0.0000···0001 * 2^-1022 instead of 1.0000···0001 * 2^-1022.

If you're looking for an equivalent mantissa and exponent such that there is a leading 1, just count the leading zeros in the mantissa and add one, subtract the result from the original exponent, and also shift the mantissa left by the result (so 0.000000101 * 2^-50 would result in 6+1 and become 1.01 * 2^-57).

这篇关于指数是如何计算浮点下的子范数的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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