Question: I am working on a program in C. The user enters a floating point numer in base ten, and the computer outputs the binary equivilent

I am working on a program in C. The user enters a floating point numer in base ten, and the computer outputs the binary equivilent in base two. Like 3.75 will give me 1.111E1.

In order to do this conversion, we need to use this code.

unsigned int float_int = *((unsigned int*)&f);

This will allow us to to the bitwise oppperators on it. otherwise floats cannot use bitwise opperators. I am really struggeling trying to seperate out the fields before the decimal point and after the decimal point using bitwise opperators. Can someone help me out here? I will only give a thumbs up if you folllow the specifications.

Thanks.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!