The mantissa will typically be the rest of an 8 or 16 bit integer (though languages such as Zig and C23 allow more adventurous integer sizes).
Since you mention histograms as the context, that would almost surely be an array of these counters. So, it's not hard to have a packed array of b-bit numbers for any b >= 1. You probably already know, but it seemed worth a mention. This is an example impl in Nim, but the ideas should port easily to any PLang with shift/mask bit-ops. It's similar to a bit-vector, but with batches of b-bits.
Since you mention histograms as the context, that would almost surely be an array of these counters.
That’s a fun idea, and amusingly I had not actually followed the thought that far :-) I didn’t have any particular application in mind (Adi didn’t say); the link to histograms is that hg64 uses the same bespoke floating point format for its bucket indexes, but the buckets themselves are straightforward atomic integers.
A hg64 histogram is reasonably parsimonious: it allocates just enough buckets to cover the power-of-two range of values it encounters. But as you suggest it could be interesting to trade off less counter precision for greater bucketing precision in the same amount of space, say. The downside is that it would be less friendly to multithreading, because of contention on the RNG and the trickiness of atomically updating a potentially unaligned bitfield.
Cool, yeah. I hadn't exactly looked into all the background (and MT-safety is definitely a thorn), but space optimizing arrays of same-sized numbers is quite common (E.g., Ada has direct PLang support for this). { BTW, Adi misattributes the 1975/78 abstract to "RTM", but it's actually due to his late father, Robert Morris { or with a "The Elder", maybe ;-) }. I don't use Twitter and it's a pretty small nit. }
EDIT: The trade off also applies to that Morris probability table not being too big as your article mentions..9 to 13 bits is probably very L1 CPU cache resident but might provide just the desired precision.
cblake | 15 hours ago
Since you mention histograms as the context, that would almost surely be an array of these counters. So, it's not hard to have a packed array of b-bit numbers for any b >= 1. You probably already know, but it seemed worth a mention. This is an example impl in Nim, but the ideas should port easily to any PLang with shift/mask bit-ops. It's similar to a bit-vector, but with batches of b-bits.
[OP] fanf | 14 hours ago
That’s a fun idea, and amusingly I had not actually followed the thought that far :-) I didn’t have any particular application in mind (Adi didn’t say); the link to histograms is that hg64 uses the same bespoke floating point format for its bucket indexes, but the buckets themselves are straightforward atomic integers.
A hg64 histogram is reasonably parsimonious: it allocates just enough buckets to cover the power-of-two range of values it encounters. But as you suggest it could be interesting to trade off less counter precision for greater bucketing precision in the same amount of space, say. The downside is that it would be less friendly to multithreading, because of contention on the RNG and the trickiness of atomically updating a potentially unaligned bitfield.
cblake | 5 hours ago
Cool, yeah. I hadn't exactly looked into all the background (and MT-safety is definitely a thorn), but space optimizing arrays of same-sized numbers is quite common (E.g., Ada has direct PLang support for this). { BTW, Adi misattributes the 1975/78 abstract to "RTM", but it's actually due to his late father, Robert Morris { or with a "The Elder", maybe ;-) }. I don't use Twitter and it's a pretty small nit. }
EDIT: The trade off also applies to that Morris probability table not being too big as your article mentions..9 to 13 bits is probably very L1 CPU cache resident but might provide just the desired precision.
[OP] fanf | 3 hours ago
Huh, I had also got the idea that Morris senior had the same initials as RTM! Thanks for pointing that out.
cblake | 2 hours ago
Father is Robert H. Morris, but usually dropped middle initial.