A371477 Positive integers that can be represented in an 8-bit floating point format.
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 22, 24, 26, 28, 30, 32, 36, 40, 44, 48, 52, 56, 60, 64, 72, 80, 88, 96, 104, 112, 120, 128, 144, 160, 176, 192, 208, 224, 240
Offset: 1
Examples
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).
Links
- Carl Burch, Floating-point representation, Carl Burch's website.
- William T. Verts, An 8-Bit Floating Point Representation
- Wikipedia, Minifloat
Crossrefs
Cf. A000265 (odd part of n).
Programs
-
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)
Comments