Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hash(::Quaternion, ::UInt) should be defined #135

Closed
hyrodium opened this issue Nov 8, 2023 · 0 comments · Fixed by #136
Closed

hash(::Quaternion, ::UInt) should be defined #135

hyrodium opened this issue Nov 8, 2023 · 0 comments · Fixed by #136

Comments

@hyrodium
Copy link
Collaborator

hyrodium commented Nov 8, 2023

The following behavior is not consistent, and can be fixed by adding hash(::Quaternion, ::UInt) method.

julia> using Quaternions

julia> isequal(1, complex(1))
true

julia> 1 |> hash
0x5bca7c69b794f8ce

julia> complex(1) |> hash
0x5bca7c69b794f8ce

julia> isequal(1, quat(1))  # isequal(a,b) == true should imply `hash(a) == hash(b)`
true

julia> quat(1) |> hash
0x37cb992a8d339608

julia> unique(Complex[complex(2), complex(big"2")])
1-element Vector{Complex}:
 2 + 0im

julia> unique(Quaternion[quat(2), quat(big"2")])
2-element Vector{Quaternion}:
  Quaternion{Int64}(2, 0, 0, 0)
 Quaternion{BigInt}(2, 0, 0, 0)

x-ref: #121 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant