简体   繁体   English

将十六进制转换为IEEE-754单精度浮点二进制科学计数法

[英]Convert hexadecimal to IEEE-754 single precision floating point binary scientific notation

I am trying to convert these numbers to binary scientific notation, but I cannot figure out the process. 我正在尝试将这些数字转换为二进制科学计数法,但是我无法弄清楚该过程。 Could someone please the process of going about solving this? 有人可以解决这个问题的过程吗?

For IEEE 754 single precision floating point, what is the number, as written in binary scientific notation, whose hexadecimal representation is the following? 对于IEEE 754单精度浮点,以二进制科学计数形式表示的数字是什么,其十六进制表示形式如下?

0061 0000 0061 0000

I can get this converted from hex to unsigned binary: 我可以将其从十六进制转换为无符号二进制:

0000 0000 0110 0001 0000 0000 0000 0000 0000 0000 0110 0001 0000 0000 0000 0000

but I can't figure out how to properly represent this using binary scientific notation. 但我不知道如何使用二进制科学计数法正确地表示这一点。 Thanks in advance! 提前致谢!

binary32 is broken into 3 sections: sign, exponent (biased) and significand (or fraction). binary32分为3个部分:符号,指数(有偏)和有效数(或分数)。

0000 0000 0110 0001 0000 0000 0000 0000
||        ||                          |
||        |\-- significand -----------/
| \ expo  /
\ sign

So in this case, 所以在这种情况下

sign (negative) = 0, so number is positive
exponent (biased) = 0000 0000
significand = .1100001 0000 0000 0000 0000

If the exponent (power of 2) is at the highest value (1111 1111), that indicates the number is special: Infinity or Not-a-Number. 如果指数(2的幂)为最大值(1111 1111),则表示该数字是特殊的:无穷大或非数字。

If the exponent is 0, the bias is -126, else the bias is -127 and an implied 1 should be added to the fraction. 如果指数为0,则偏差为-126,否则偏差为-127,并且应在分数上加上隐含的1

sign = 0 (positive) or +1
exponent = 0 - 126
significand = 0.1100001 =  (binary) 1100001/10000000 = 97/128

+1 * pow(2, -126) * 97/128 = 8.9080431273251475213255815711373...e-39

Notes: 笔记:
On-line converters available. 提供在线转换器。 example
Endian: the order in which the bytes are to be interpreted can vary. 字节序:字节的解释顺序可以不同。 0061 0000 could be 00 00 61 00 . 0061 0000可以是00 00 61 00 An assumption was made here with this example. 在此示例中进行了假设。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM