[英]Converting binary to floating point
How would one convert a binary to a floating point? 如何将二进制转换为浮点数? I don't see many implementations on this one (only floating point to binary). 我在这一点上看不到很多实现(只是浮点数到二进制)。
So for example: 因此,例如:
int main() {
char example[32] = "-101.1101";
float result = makeFloat(example);
printf("Float number representation is: %f\n", result);
}
float makeFloat(char* f) {
/* Empty */
}
Which the output would be: 输出为:
-5.8125
Trying to get some practice in, but after hours of trying to figure it out, here I am asking for help. 尝试进行一些练习,但是经过数小时的尝试后,我在这里寻求帮助。
You can refer to the website: 您可以访问以下网站:
http://www.cprogramto.com/c-program-convert-binary-float/ http://www.cprogramto.com/c-program-convert-binary-float/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.