Given a floating point number, the challenge is to find the hexadecimal representation for the IEEE 754 number.
IEEE Standard for Floating Point Arithmetic (IEEE 754) — it is a technical standard for floating point computing that was established in 1985 by the Institute of Electrical and Electronic Engineers (IEEE). The standard addresses many of the problems found in various floating point implementations that make them difficult to use reliably and reduces portability. The IEEE 754 floating point standard is today the most common representation for real numbers on computers, including Intel-based PCs, Macs and most Unix platforms.

Examples:
Input: -6744.90 Output: C5D2C733 Input: -263.3 Output: C383A666
Suitable:
- Check if the number is positive or negative. Store the sign as 0 for positive and 1 for negative, then convert the number to positive if negative.
- Convert the number with floating point to binary .
- Separate the decimal part and the integer part.
- Calculate the exponent ( E) and convert it to binary.
- Find the mantissa.
- Concatenate the sign of the mantissa, degree and mantissa.
- Convert this to hex.
Let’s write a Python program to represent a floating number in IEEE 754 hexadecimal format.
|
Exit :
4383A666 C383A666