4 ms·
> I don’t think there’s any real use case for it Histogram where you want to keep a count for each float value you’ve seen (maybe rounded to some precision to
by mprime1 4y ago
> I don’t think there’s any real use case for it
Histogram where you want to keep a count for each float value you’ve seen (maybe rounded to some precision to reduce the number of buckets)
Not disagreeing with your comment, just saying it’s not uncommon
- iudqnolq 4y agoWhy not just multiply each key by ten to the power of your desired precision, then convert to int? If you're rounding anyway it's basically the same amount of work.
- mprime1 4y agoYou can certainly map floats to int ‘bin number’ which is the index into an array. No need for a map. But the ‘naive’ histogram is an example of a map using float keys.
- chubot 4y agoHm I don't agree that example means it's "not uncommon" -- why would you want to hash the float rather than the bucket number? Hashing the floats themselves isn't going to give you a useful histogram. Is there a codebase that hashes float to a useful effect? If it exists, I'd be interested to see it