Representation of zero: 0 00 000
Subnormal numbers, scaled to integers The significand is extended with "0.": 0 00 001 = 0.001_2 * 2^x = 0.125 * 2^x = 1 (least subnormal number) ... 0 00 111 = 0.111_2 * 2^x = 0.875 * 2^x = 7 (greatest subnormal number)
Normalized numbers, scaled to integers The significand is extended with "1.": 0 01 000 = 1.000_2 * 2^x = 1 * 2^x = 8 (least normalized number) 0 01 001 = 1.001_2 * 2^x = 1.125 * 2^x = 9 ... 0 01 111 = 1.001_2 * 2^x = 1.875 * 2^x = 15 0 10 000 = 1.001_2 * 2^x = 1.000 * 2^(x+1) = 16 0 10 001 = 1.001_2 * 2^x = 1.125 * 2^(x+1) = 18 ... 0 10 111 = 1.110_2 * 2^x = 1.875 * 2^(x+1) = 30 0 11 000 = +infinity x 11 yyy (y != 0) = Nan
then the Wikipedia page concludes that the exponent bias in their example should be -2 for some reason (maybe -(x-1)?), and then i think they are saying that e.g. 0 00 001 represents 0.001_2 * 2^0 = 0.125 * 1 = 0.125. https://en.wikipedia.org/wiki/Exponent_bias implicitly suggests that the exponent bias should be (2^(exponent_bit_width-1)-1), which in the case of the example on the Minifloat Wikipedia page yields 7 (not -2 as they say; although the Exponent_bias wikipedia page is saying that the positive 'bias' is subtracted from the given encoded exponent; note that the Minifloat wikipedia page gives a table of 'All values as decimals' in which only the first row yields fractions, which seems odd), and in this case yields 1. But according to http://weitz.de/ieee/, even though for 32-bit floats the exponent is 127 according to the Expontent_bias wikipedia page, for subnormals the biased exponent is -126 and for normals it's also -126. So i guess you add one to it to get the lowest one (so our lowest factor is 2^(-bias + 1) = 2^(-1 + 1) = 2^0. So following this pattern, with our 2 bit exponents (so bias = 1 by the reasoning above) we have:
Representation of zero: 0 00 000 Subnormal numbers The significand is extended with "0.": 0 00 001 = 0.001_2 * 2^0 = 0.125 = 0.125 (least subnormal number) ... 0 00 111 = 0.111_2 * 2^0 = 0.875 = 0.875 (greatest subnormal number)
Normalized numbers, scaled to integers The significand is extended with "1.": 0 01 000 = 1.000_2 * 2^0 = 1 = 1 (least normalized number) 0 01 001 = 1.001_2 * 2^0 = 1.125 * 1 = 1.125 ... 0 01 111 = 1.001_2 * 2^0 = 1.875 * 1 = 1.875 0 10 000 = 1.001_2 * 2^1 = 1.000 * 2 = 2 0 10 001 = 1.001_2 * 2^1 = 1.125 * 2 = 2.25 ... 0 10 111 = 1.110_2 * 2^1 = 1.875 * 2 = 3.75 0 11 000 = +infinity x 11 yyy (y != 0) = Nan
I gotta say, i might prefer more exponent bits than significand bits if the range is gonna be that small, especially for immediate operand literals. What if we had 3 exponent bits and 2 significand bits; i think we'd end up with exponent bias 3, so smallest exponent -2, so:
Representation of zero: 0 000 00 Subnormal numbers The significand is extended with "0.": 0 000 01 = 0.01_2 * 2^-2 = 0.25/4 = 0.0625 (least subnormal number) 0 000 10 = 0.10_2 * 2^-2 = 0.50/4 = 0.125 0 000 11 = 0.11_2 * 2^-2 = 0.75/4 = 0.1875 (greatest subnormal number)
Normalized numbers, scaled to integers The significand is extended with "1.": 0 001 00 = 1.00_2 * 2^-2 = 1/4 = .25 (least normalized number) 0 001 01 = 1.01_2 * 2^-2 = 1.25/4 = .3125 0 001 10 = 1.10_2 * 2^-2 = 1.50/4 = .375 0 001 11 = 1.01_2 * 2^-2 = 1.75/4 = .4375 0 010 00 = 1.00_2 * 2^-1 = 1/2 = .5 0 010 01 = 1.01_2 * 2^-1 = 1.25/2 = .625 0 010 10 = 1.10_2 * 2^-1 = 1.50/2 = .75 0 010 11 = 1.11_2 * 2^-1 = 1.75/2 = .875 0 011 00 = 1.00_2 * 2^0 = 1*1 = 1 0 011 01 = 1.01_2 * 2^0 = 1.25*1 = 1.25 0 011 10 = 1.10_2 * 2^0 = 1.50*1 = 1.5 0 011 11 = 1.11_2 * 2^0 = 1.75*1 = 1.75 0 100 00 = 1.00_2 * 2^1 = 1*2 = 2 0 100 01 = 1.01_2 * 2^1 = 1.25*2 = 2.5 0 100 10 = 1.10_2 * 2^1 = 1.50*2 = 3 0 100 11 = 1.11_2 * 2^1 = 1.75*2 = 3.5 0 101 00 = 1.00_2 * 2^2 = 1*4 = 4 0 101 01 = 1.01_2 * 2^2 = 1.25*4 = 5 0 101 10 = 1.10_2 * 2^2 = 1.50*4 = 6 0 101 11 = 1.11_2 * 2^2 = 1.75*4 = 7 0 110 00 = 1.00_2 * 2^3 = 1*8 = 8 0 110 01 = 1.01_2 * 2^3 = 1.25*8 = 10 0 110 10 = 1.10_2 * 2^3 = 1.50*8 = 12 0 110 11 = 1.11_2 * 2^3 = 1.75*8 = 14 0 111 00 = +infinity x 111 yy (y != 0) = NaN?
that seems more useful for some reason. I guess what you lose out on with one less bit in the significand is the ability to say things like 1.125 and 1.875, and also 2.25, 3.75; so you get less gradations above 1, in exchange for more gradations below 1 and a bigger range.
What if we had 4 exponent bits and just 1 significand bit?
Representation of zero: 0 000 00 Subnormal numbers The significand is extended with "0.": 0 0000 1 = 0.1_2 * 2^-6 = 0.5/64 = 0.0078125 (least (and only, in this case) subnormal number)
Normalized numbers, scaled to integers The significand is extended with "1.": 0 0001 0 = 1.0_2 * 2^-6 = 1/64 = 0.015625 (least normalized number) 0 0001 1 = 1.1_2 * 2^-6 = 1.5/64 = 0.0234375 0 0010 0 = 1.0_2 * 2^-5 = 1/32 = 0.03125 0 0010 1 = 1.1_2 * 2^-5 = 1.5/32 = 0.046875 0 0011 0 = 1.0_2 * 2^-4 = 1/16 = 0.0625 0 0011 1 = 1.1_2 * 2^-4 = 1.5/16 = 0.09375 0 0100 0 = 1.0_2 * 2^-3 = 1/8 = .125 0 0100 1 = 1.1_2 * 2^-3 = 1.5/8 = .1875 0 0101 0 = 1.0_2 * 2^-2 = 1/4 = .25 0 0101 1 = 1.1_2 * 2^-2 = 1.5/4 = .375 0 0110 0 = 1.0_2 * 2^-1 = 1/2 = 0.5 0 0110 1 = 1.1_2 * 2^-1 = 1.5/2 = .75 0 0111 0 = 1.0_2 * 2^0 = 1*1 = 1 0 0111 1 = 1.1_2 * 2^0 = 1.5*1 = 1.5 0 1000 0 = 1.0_2 * 2^1 = 1*2 = 2 0 1000 1 = 1.1_2 * 2^1 = 1.5*2 = 3 0 1001 0 = 1.0_2 * 2^2 = 1*4 = 4 0 1001 1 = 1.1_2 * 2^2 = 1.5*4 = 6 0 1010 0 = 1.0_2 * 2^3 = 1*8 = 8 0 1010 1 = 1.1_2 * 2^3 = 1.5*8 = 12 0 1011 0 = 1.0_2 * 2^4 = 1*16 = 16 0 1011 1 = 1.1_2 * 2^4 = 1.5*16 = 24 0 1100 0 = 1.0_2 * 2^5 = 1*32 = 32 0 1100 1 = 1.1_2 * 2^5 = 1.5*32 = 48 0 1101 0 = 1.0_2 * 2^6 = 1*64 = 64 0 1101 1 = 1.1_2 * 2^6 = 1.5*64 = 96 0 1110 0 = 1.0_2 * 2^7 = 1*128 = 128 0 1110 1 = 1.1_2 * 2^7 = 1.5*128 = 192 0 1111 0 = +infinity x 1111 1 = NaN?