如何计算 IEEE 扩展双精度的最小值和最大值?

发布于 2024-08-23 02:51:54 字数 153 浏览 1 评论 0原文

我知道最小值和值为:
分钟:3.362...10-4932
最大值:1.189... 10+4932
(2^14) * log(2) ~ 4932 这给了我指数部分。但我无法计算出尾数。

I know that the min and values are:
min:3.362... 10-4932
max:1.189... 10+4932
and (2^14) * log(2) ~ 4932 which gives me the exponential part. But I can't figure out mantissa.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

何以畏孤独 2024-08-30 02:51:54

尾数有一个隐含的开始位。这避免了为始终为 1 的位浪费一位存储空间(除了减少的浮点数,这是所有指数位都为零时的特殊情况)。

请注意,隐式第一位数字只能采用二进制。例如,在十进制中,您可能有 3.14e+2,并且您不能只删除第一个数字 (3),因为您不知道它是哪个数字(1-9)。

例如,浮点值 seeemmmmm 将被读为 (在 C 风格的伪代码中)

(s ? -1 : 1) * ((binary)1mmmmm << ((binary)eee - bias));

其中,bias 是该特定浮点类型的常量,因此所有指数值 (eee) 都可以为正,并且 000 是最负的指数,

因此,您可以通过 0b111111(1)计算最大值。比尾数多的位)移动了指数的最大值(无偏),最小值与负号相同。

Mantissa has an implicit beginning one bit. This avoids wasting one bit of storage for the bit which is always one (except for reduced floats, which are a special case when all exponent bits are zero).

Notice that the implicit first digit is only possible in binary. E.g. in decimal you might have 3.14e+2 and you cannot just drop the first digit (3) because you wouldn't know which number (1-9 it was anymore.

For example, a floating point value seeemmmmm would be read as (in C-style pseudo code)

(s ? -1 : 1) * ((binary)1mmmmm << ((binary)eee - bias));

Where bias is a constant for this particular floating-point type so that all exponent values (eee) can be positive and 000 is the most negative exponent.

So, you can calculate the maximum value by 0b111111 (one more bit than there is in the mantissa) shifted by the maximum value (unbiased) of the exponent. The minimum value is the same with a negative sign.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文