A repository to work with a custom floating point format of binary numbers.
This for-fun project is an over-kill version of a single question on the second assignment of the Trent University course, COIS-2300H.
A minifloat is an adaption of the IEEE 754
standard for storing floating point numbers in binary. In that standard, a floating point number is stored as follows:
- The first of 32 bits is a sign-bit: 0 for positive, 1 for negative
- The next 8 bits store the exponent, biased with -127.
- The final 23 bits stores the mantissa.
From Wikipedia:
becomes:
Our MiniFloat system from COIS-2300H is very similar, and works exactly the same. However, it has:
- The first bit is once again a sign-bit.
- The next four are used to store the exponent.
- The final three store the mantissa/fraction of the number.
This allows for a smaller number, making it easier to perform arithmetic by hand on paper, but at the cost of accuracy.
This 'calculator' is not 100% accurate, and fails on certain edge cases, particularly with larger powers. It is only a proof of concept meant to demonstrate an understanding of the process of floating point computations.