Skip to content
  • Damien George's avatar
    py: Add very simple but correct hashing for float and complex numbers. · 19f2e47d
    Damien George authored
    Hashing of float and complex numbers that are exact (real) integers should
    return the same integer hash value as hashing the corresponding integer
    value.  Eg hash(1), hash(1.0) and hash(1+0j) should all be the same (this
    is how Python is specified: if x==y then hash(x)==hash(y)).
    
    This patch implements the simplest way of doing float/complex hashing by
    just converting the value to int and returning that value.
    19f2e47d