Ideally the following code would take a float in IEEE 754 representation and convert it into hexadecimal
void convert() //gets the float input from user and turns it into hexadecimal
printf("Enter float: ");
printf("hex is %x", f);
I'm not too sure what's going wrong. It's converting the number into a hexadecimal number, but a very wrong one.
123.1443 gives 40000000
43.3 gives 60000000
8 gives 0
so it's doing something, I'm just not too sure what.
Help would be appreciated
以上就是Convert ieee 754 float to hex with c - printf的详细内容，更多请关注web前端其它相关文章！