Bug 26334 - WTF::FloatHash is invalid for 0 / -0
Summary: WTF::FloatHash is invalid for 0 / -0
Status: RESOLVED DUPLICATE of bug 98627
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-11 15:39 PDT by Geoffrey Garen
Modified: 2022-07-21 13:21 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Geoffrey Garen 2009-06-11 15:39:30 PDT
Because FloatHash does a bitwise hash, 0 and -0 get different hash values, even though they compare equal. That's a hash table no-no.

More info here: http://virtualdub.org/blog/pivot/entry.php?id=259.

Simplest solution is to mask the sign bit when computing a FloatHash. Another option is to treat -0 as a special case, and return the hash value for 0.
Comment 1 Ahmad Saleem 2022-07-21 13:18:34 PDT
I think it got fixed in following commit:

https://github.com/WebKit/WebKit/commit/cf04259b238524f34209400f7fc0962b7473f03f

I think this can be marked as RESOLVED INVALID or RESOLVED CONFIGURATION CHANGED. Thanks!
Comment 2 Alexey Proskuryakov 2022-07-21 13:21:48 PDT
Seems like it indeed.

*** This bug has been marked as a duplicate of bug 98627 ***