3 ms·
You've already got zero and negative zero as an outlying case. I'm not sure why anyone would feel comfortable using floats as keys in a map. To anyone who has
by akira2501 4y ago
You've already got zero and negative zero as an outlying case. I'm not sure why anyone would feel comfortable using floats as keys in a map. To anyone who has done this.. why? What was the use case?
- craigching 4y agoGo has no built-in set data structure, you use map if you don’t want to bring in a third party. Maybe this is why?
- Ferret7446 4y agoA set of floats sounds like an equally questionable idea as a map of float keys, for the exact same reason.
- deleted 4y ago[deleted]
- wallstop 4y agoFor a game I'm making, I have a helper function that takes in a specified time (as a float) and returns a (heap based) wait instruction. The times are literals sprinkled throughout the code base of callers of this function, so I maintain a cache of time -> wait instruction to reduce allocations.
- iudqnolq 4y agoWouldn't your life be much simplier if you'd represented time as integer milliseconds? I totally get it being too late now, but I think that's an argument for making floats a little bit unpleasant to start working with.