[英]Read half precision float (float16 IEEE 754r) binary data in matlab
you have been a great help last time, i hope you can give me some advise this time, too. 上次您的帮助很大,希望这次也能给我一些建议。
I read a binary file into matlab with bit16 (format = bitn) and i get a string of ones and zeros. 我用bit16(format = bitn)将一个二进制文件读入matlab,得到一串一和零。
bin = '1,00011,1111111111'
(16 bits: 1. sign, 2-6. exponent, 7-16. mantissa) bin = '1,00011,1111111111'
(16位:1。符号,2-6。指数,7-16。尾数)
According to ftp://www.fox-toolkit.org/pub/fasthalffloatconversion.pdf it can be converted like 根据ftp://www.fox-toolkit.org/pub/fasthalffloatconversion.pdf,它可以像
out = (-1)^bin(1) * 2^(bin(2:6)-15) * 1.bin(7:16)
[are exponent and mantissa still binary?] out = (-1)^bin(1) * 2^(bin(2:6)-15) * 1.bin(7:16)
[指数和尾数是否仍为二进制?]
Can someone help me out and tell me how to deal with the 'eeeee' and '1.mmmmmmmmmm' as mentioned in the pdf, please. 有人可以帮我一下,告诉我如何处理pdf中提到的'eeeee'和'1.mmmmmmmmmm'。
Thanks a lot! 非常感谢!
Michael 麦可
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.