Pre-Requisite: IEEE Standard 754 Floating Point Numbers
Write a program to find out the 32 Bits Single Precision IEEE 754 Floating-Point representation of a given real value and vice versa.
Input: real number = 16.75 Output: 0 | 10000011 | 00001100000000000000000 Input: floating point number = 0 | 10000011 | 00001100000000000000000 Output: 16.75
Bit Fields are assigned when we don’t require the full memory that is usually allocated to some variables but we want to limit the amount of memory taken up by those variables. In C, members of a Union share the common memory space and taken we can access the members only one at a time.
Below is the implementation of the above approach:
Program 1: Convert a real value to its floating point representation
IEEE 754 representation of -2.250000 is : 1 | 10000000 | 00100000000000000000000
Program 2: Convert a floating point representation to its real value
The float value of the given IEEE-754 representation is : -2.250000
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- IEEE Standard 754 Floating Point Numbers
- Difference between Single Precision and Double Precision
- C Program to Multiply two Floating Point Numbers
- Why floating-point values do not represent exact value
- Measure execution time with high precision in C/C++
- Differnce between Bits and Quantum Bits
- Program for Binary To Decimal Conversion
- Program for Decimal to Binary Conversion
- Program for Octal to Decimal Conversion
- C Program for Decimal to Binary Conversion
- Lex program for Decimal to Hexadecimal Conversion
- Program for Decimal to Octal Conversion
- C program to count zeros and ones in binary representation of a number
- C Program for Number of jump required of given length to reach a point of form (d, 0) from origin in 2D plane
- Multiplication Algorithm in Signed Magnitude Representation
- 8085 program to move blocks of bits from source location to a destination location
- C/C++ Program to Count set bits in an integer
- Introduction of Single Accumulator based CPU organization
- Working of 8085-based Single board microcomputer
- Differences between Single Datapath and Pilpeline Datapath
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : amit_mangal_