Floating Point Binary Converter

The purpose of this challenge is to write a Python program that will receive, as an input, a binary number expressed using a normalised floating point representation (using a 5-bit mantissa and a 3-bit exponent). The program will then calculate the decimal value matching the input.

The following conversion tool will help you work out the formula used to convert a normalised floating point binary number to a decimal number.

Python Code


Extension


Adapt your code to let the user input the number of bits used for the mantissa and the number of bits used for the exponent. Your program will then use these inputs to validate and convert a binary number entered by the user.

Did you like this challenge?

Click on a star to rate it!

Average rating 3.4 / 5. Vote count: 32

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!