So in my last entry on this subject, I said I'd only talk about binary floating-point, because other bases are less interesting. Turns out that's not true!
Octal and hexadecimal (both of those have existed) -- yeah, those are basically binary, except the fact that since the base isn't 2 you can't use a hidden bit; so yeah, less interesting than binary.
But decimal... well, I assumed decimal floating point was just like other no-hidden-bit floating point formats, except with a BCD mantissa. And, I'm sure there have been decimal floating point formats that worked that way! (Hell, I expect there have probably been ones with a BCD mantissa and BCD exponent.) But IEEE 754 is actually much weirder!
I'm not going to detail it here, you can look up the details yourself, but:
1. There's not the usual separation into exponent and mantissa; rather there's a "combination" field that mixes together the most significant bits of both. There's then a trailing mantissa field, for the rest of the mantissa, and, preceding that in some variants, a trailing exponent field for the rest of the exponent.
2. Each format is actually not one format but two, because there are two different mantissa encodings you can use, and depending on which one you use, the combination field is interpreted differently.
3. One of the mantissa formats consists of having the most-significant digit (which is partially encoded in the combination field) in BCD, and the rest in densely packed decimal. Densely packed decimal encodes 3 decimal digits per 10 bits. You might think that means it's just binary-coded-millary (?), but no, it's a special coding, not that.
4. The other mantissa format consists of having the entire mantissa just be in binary, and then just restricting the allowed range of it.
So, uh, yeah. IEEE 754 decimal floating-point is weird. You can look up the rest of the details yourself.
Btw, the famous Setun ternary computer also had floating point! It's worth talking here about its integer format, because for signed integers, it used balanced ternary! What about unsigned integers? Well, it didn't have those.
So how did its floating point work? Well, uh, no idea, I couldn't quickly find English documentation on the matter. But given that the whole computer is based on balanced ternary, I think we can guess. Since it's not binary, there's no hidden bit. The mantissa would be balanced ternary, which means we don't need an explicit sign bit separate from the mantissa. And presumably the exponent would be balanced ternary too. And since there's no hidden bit we don't need to treat the minimum exponent specially.
That only leaves the question of whether the mantissa was treated as starting in the 1's place or in the ⅓'s place. As best I can tell from the documentation I could find, I think it was treated as starting in the 1's place. So yeah, that's another way you could do floating point! I mean, if you have a native ternary computer...
-Harry
Octal and hexadecimal (both of those have existed) -- yeah, those are basically binary, except the fact that since the base isn't 2 you can't use a hidden bit; so yeah, less interesting than binary.
But decimal... well, I assumed decimal floating point was just like other no-hidden-bit floating point formats, except with a BCD mantissa. And, I'm sure there have been decimal floating point formats that worked that way! (Hell, I expect there have probably been ones with a BCD mantissa and BCD exponent.) But IEEE 754 is actually much weirder!
I'm not going to detail it here, you can look up the details yourself, but:
1. There's not the usual separation into exponent and mantissa; rather there's a "combination" field that mixes together the most significant bits of both. There's then a trailing mantissa field, for the rest of the mantissa, and, preceding that in some variants, a trailing exponent field for the rest of the exponent.
2. Each format is actually not one format but two, because there are two different mantissa encodings you can use, and depending on which one you use, the combination field is interpreted differently.
3. One of the mantissa formats consists of having the most-significant digit (which is partially encoded in the combination field) in BCD, and the rest in densely packed decimal. Densely packed decimal encodes 3 decimal digits per 10 bits. You might think that means it's just binary-coded-millary (?), but no, it's a special coding, not that.
4. The other mantissa format consists of having the entire mantissa just be in binary, and then just restricting the allowed range of it.
So, uh, yeah. IEEE 754 decimal floating-point is weird. You can look up the rest of the details yourself.
Btw, the famous Setun ternary computer also had floating point! It's worth talking here about its integer format, because for signed integers, it used balanced ternary! What about unsigned integers? Well, it didn't have those.
So how did its floating point work? Well, uh, no idea, I couldn't quickly find English documentation on the matter. But given that the whole computer is based on balanced ternary, I think we can guess. Since it's not binary, there's no hidden bit. The mantissa would be balanced ternary, which means we don't need an explicit sign bit separate from the mantissa. And presumably the exponent would be balanced ternary too. And since there's no hidden bit we don't need to treat the minimum exponent specially.
That only leaves the question of whether the mantissa was treated as starting in the 1's place or in the ⅓'s place. As best I can tell from the documentation I could find, I think it was treated as starting in the 1's place. So yeah, that's another way you could do floating point! I mean, if you have a native ternary computer...
-Harry