Rounding won't work either, at least if you're trying to find a way to do a hash join on float-comparison-within-epsilon. You would need to have a function such that |a-b|<p implies f(a)=f(b) and there is none, except the useless trivial one.
You can do it if you produce two hash values for each key (and clean up your duplicates later), but not if you produce only one.
Of course most of the time if you are doing equality comparisons on floats you have a fundamental conceptual problem with your code.
You can do it if you produce two hash values for each key (and clean up your duplicates later), but not if you produce only one.
Of course most of the time if you are doing equality comparisons on floats you have a fundamental conceptual problem with your code.