Skip to content

Floats are equal, but their hash is different #513

@Darkdragon84

Description

@Darkdragon84

It generally holds that if two hashable objects are equal, their hashes must be the same.

It seems that python builtin float and symengine.Float violate this rule:

from symengine import Float

Float(2.2) == 2.2 # True
hash(Float(2.2)) == hash(2.2) # False

Shouldn't the hash of a symengine.Float just use the python float's hash?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions