funcool / decimal

An arbitrary-precision Decimal type for ClojureScript
http://funcool.github.io/decimal/latest/
BSD 2-Clause "Simplified" License
13 stars 6 forks source link

Equality is broken for non decimal types #10

Open jjttjj opened 4 years ago

jjttjj commented 4 years ago

(= (dc/decimal 123) :x) results in

#object[Error Error: [DecimalError] Invalid argument: :x]

Due to the IEquiv implementation here: https://github.com/funcool/decimal/blob/c0bee2ee62c62a3ba2a80008ec02e01daa0a736e/src/decimal/core.cljs#L752

It should check that the thing being compared is a number or decimal type.

I will send a PR soon.

hipitihop commented 2 years ago

We have seen the same with not=