Nick Maclaren schrieb: >> I personally consider *very* important that hash(5.0) == hash(5) (and >> that 5.0 == 5, of course). > > It gets a bit problematic with floating-point, when you can have > different values "exactly 5.0" and "approximately 5.0". IEEE 754 > has signed zeroes. And so it goes. [not sure what "And so it goes" means in English] It may be a bit problematic to implement, but I think a clean specification is possible. If a and b are numbers, and a==b, then hash(a)==hash(b). I'm not sure whether "approximately 5.0" equals 5 or not: if it does, it should hash the same as 5, if it doesn't, it may or may not hash the same (whatever is easier to implement). For 0: hash(+0.0)==hash(-0.0)==hash(0)=hash(0L)=0 Regards, Martin
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4