简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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