A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-May/004037.html below:

[Patches] fix float_hash and complex_hash for 64-bit *nix

[Python-Dev] Re: [Patches] fix float_hash and complex_hash for 64-bit *nix [Python-Dev] Re: [Patches] fix float_hash and complex_hash for 64-bit *nixGuido van Rossum guido@python.org
Thu, 11 May 2000 09:01:10 -0400
I have to admit I have no clue about the details of this debate any
more, and I'm cowardly awaiting a patch submission that Tim approves
of.  (I'm hoping a day will come when Tim can check it in himself. :-)

In the mean time, I'd like to emphasize the key invariant here: we
must ensure that (a==b) => (hash(a)==hash(b)).  One quick way to deal
with this could be the following pseudo C:

    PyObject *double_hash(double x)
    {
        long l = (long)x;
        if ((double)l == x)
	    return long_hash(l);
	...double-specific code...
    }

This code makes one assumption: that if there exists a long l equal to
a double x, the cast (long)x should yield l...

--Guido van Rossum (home page: http://www.python.org/~guido/)



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