Decimals.jl icon indicating copy to clipboard operation
Decimals.jl copied to clipboard

hash(::Decimal) fails

Open altre opened this issue 5 years ago • 1 comments

Thanks for this package! Calling hash on a Decimal fails in julia 1.5.3:


julia> p =parse(Decimal, "0.1")
Decimal(0, 1, -1)

julia> hash(p)
ERROR: MethodError: no method matching decompose(::Decimal)

Which effectively prevents many other important methods, such as unique:

julia> unique([p,p])
ERROR: MethodError: no method matching decompose(::Decimal)
Closest candidates are:
  decompose(::BigFloat) at hashing2.jl:195
  decompose(::Float64) at hashing2.jl:184
  decompose(::Float32) at hashing2.jl:173

altre avatar Dec 16 '20 14:12 altre

Duplicate of #35.

jmkuhn avatar Feb 09 '21 17:02 jmkuhn