OFFSET
1,2
COMMENTS
A floating point number representation as a bit string consists of a sign bit, some bits for an exponent for a power of two and the remaining bits are for a mantissa for a fixed point number.
In this 8-bit format, there is one sign bit (S), four exponent bits (E) and three mantissa bits (M). These 8-bit strings correspond to rational numbers (-1)^S * 1.M * 2^(E-7), where 1.M and E are interpreted as numbers written in binary (note the exponent bias of 7), except when the exponent bit string is 0000 or 1111. See Burch or Wikipedia for more details on this format.
This is not the only possible apportionment of the bits. E.g. Verts (2005) proposes an 8-bit format with three exponent bits and four mantissa bits. In the Verts system, the only positive integers that can be represented are the integers from 1 to 15.
LINKS
Carl Burch, Floating-point representation, Carl Burch's website.
William T. Verts, An 8-Bit Floating Point Representation
Wikipedia, Minifloat
EXAMPLE
18 is in the sequence because it can be represented as 0 1011 001, meaning sign bit 0, exponent 11-7 = 4, and tacit leading 1 plus explicit 1/8 for the mantissa. The corresponding number in binary is then 1.001 * 10^(1011-111), or in decimal 1.125 * 2^(11-7) = 9/8 * 16 = 18.
19 is not in the sequence because it would require at least four mantissa bits.
20 is in the sequence because it can be represented as 0 1011 010.
256 is not in this sequence because it would require exponent 8, so the exponent bits would be 1111 (15 in binary, with 15-7 = 8), but that exponent bit string is reserved for a special, non-numerical interpretation. 512 or 1024 are also not in this sequence because their exponents do not fit into four bits (taking into account the bias of 7).
PROG
(Scala) def oddPart(n: Int): Int = {
if (n == 0) {
0
} else {
var num = n
while (num % 2 == 0) {
num >>= 1
}
num
}
}
(1 to 255).filter(oddPart(_) < 16)
CROSSREFS
KEYWORD
nonn,fini,full
AUTHOR
Alonso del Arte, Mar 25 2024
STATUS
approved