Calculator to convert binary to float value — what am I doing wrong?

前端 未结 1 683
说谎
说谎 2021-01-12 15:06

I have the following code, which writes 6 floats to disk in binary form and reads them back:

#include 
#include 

int main()
{
         


        
相关标签:
1条回答
  • 2021-01-12 15:40

    This is an endianness issue if you for example switch:

    1f 85 6b 3e 
    

    to:

    3e 6b 85 1f
    

    this will result in .23 when you convert it using one of your converters, for example I used IEEE 754 Converter and Floating Point to Hex Converter allows you to do double as well as single precision conversions.

    0 讨论(0)
提交回复
热议问题