Last active
September 19, 2022 19:35
-
-
Save m-ou-se/5cd42f9dfc1753a10f8712a179596a6e to your computer and use it in GitHub Desktop.
6-bit Floating point values
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The overview below shows all 6-bit floating point values using a sign bit, a 3-bit exponent and a 2-bit mantissa. | |
This should give you an idea of how floating point values work. The standard 32 bit and 64 bit floats | |
we all know are exactly the same, but just with more bits for both the exponent and mantissa. | |
S EEE MM | |
0 111 11 NaN | |
0 111 10 NaN | |
0 111 01 NaN | |
0 111 00 +Infinity | |
0 110 11 +1110 ( = +14 ) | |
0 110 10 +1100 ( = +12 ) | |
0 110 01 +1010 ( = +10 ) | |
0 110 00 +1000 ( = +8 ) | |
0 101 11 +111 ( = +7 ) | |
0 101 10 +110 ( = +6 ) | |
0 101 01 +101 ( = +5 ) | |
0 101 00 +100 ( = +4 ) | |
0 100 11 +11.1 ( = +3.5 ) | |
0 100 10 +11.0 ( = +3 ) | |
0 100 01 +10.1 ( = +2.5 ) | |
0 100 00 +10.0 ( = +2 ) | |
0 011 11 +1.11 ( = +1.75 ) | |
0 011 10 +1.10 ( = +1.5 ) | |
0 011 01 +1.01 ( = +1.25 ) | |
0 011 00 +1.00 ( = +1 ) | |
0 010 11 +0.111 ( = +0.875 ) | |
0 010 10 +0.110 ( = +0.75 ) | |
0 010 01 +0.101 ( = +0.625 ) | |
0 010 00 +0.100 ( = +0.5 ) | |
0 001 11 +0.0111 ( = +0.4375 ) | |
0 001 10 +0.0110 ( = +0.375 ) | |
0 001 01 +0.0101 ( = +0.3125 ) | |
0 001 00 +0.0100 ( = +0.25 ) | |
0 000 11 +0.0011 ( = +0.1875 ) | |
0 000 10 +0.0010 ( = +0.125 ) | |
0 000 01 +0.0001 ( = +0.0625 ) | |
0 000 00 +0.0000 ( = +0 ) | |
1 000 00 -0.0000 ( = -0 ) | |
1 000 01 -0.0001 ( = -0.0625 ) | |
1 000 10 -0.0010 ( = -0.125 ) | |
1 000 11 -0.0011 ( = -0.1875 ) | |
1 001 00 -0.0100 ( = -0.25 ) | |
1 001 01 -0.0101 ( = -0.3125 ) | |
1 001 10 -0.0110 ( = -0.375 ) | |
1 001 11 -0.0111 ( = -0.4375 ) | |
1 010 00 -0.100 ( = -0.5 ) | |
1 010 01 -0.101 ( = -0.625 ) | |
1 010 10 -0.110 ( = -0.75 ) | |
1 010 11 -0.111 ( = -0.875 ) | |
1 011 00 -1.00 ( = -1 ) | |
1 011 01 -1.01 ( = -1.25 ) | |
1 011 10 -1.10 ( = -1.5 ) | |
1 011 11 -1.11 ( = -1.75 ) | |
1 100 00 -10.0 ( = -2 ) | |
1 100 01 -10.1 ( = -2.5 ) | |
1 100 10 -11.0 ( = -3 ) | |
1 100 11 -11.1 ( = -3.5 ) | |
1 101 00 -100 ( = -4 ) | |
1 101 01 -101 ( = -5 ) | |
1 101 10 -110 ( = -6 ) | |
1 101 11 -111 ( = -7 ) | |
1 110 00 -1000 ( = -8 ) | |
1 110 01 -1010 ( = -10 ) | |
1 110 10 -1100 ( = -12 ) | |
1 110 11 -1110 ( = -14 ) | |
1 111 00 -Infinity | |
1 111 01 NaN | |
1 111 10 NaN | |
1 111 11 NaN | |
- What's different about the values where the exponent bits are all zero? | |
- 1.0 is represented with 011 (=3) as the exponent bits. What would the table look like if we had | |
chosen 1.0 to be represented by 110 (=6) as the exponent bits? When would this be useful? | |
- What would the table look like for 5-bit floats, with only one bit for the mantissa? | |
- How about a 4-bit float with zero bits for the mantissa? Is it possible to have no mantissa bits? | |
- How many different representations of NaN does a standard 32 bit float have? And how about a 64 bit float? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment