You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can change d1 and d2 to any two numbers that "end in" (or I guess, more accurately, have the significant digits) 1011, and you still get the panic, e.g. 10.11 or 0.00000001011 -- basically as long as digits=[1011], you'll get the panic.
It does not happen when you go in the other direction, like with 10110 because then you get scale=0, digits=[10110], which hashes differently. Unless you use .normalized() on them first; since you then get something like scale=-1, digits=[1011] instead, which once more gives an identical hash, (I was mistaken about that; while normalizing do give them identical digits, they still hash differently)
The text was updated successfully, but these errors were encountered:
Easy solution would be to be format to scientific notation and hash that… but it’d be nicer of course to not have to allocate a string (but Hash has been doing that for 7 years and nobody has complained)
Hash should include precision, right? So hash(1.2) != hash(1.200), despite 1.2 == 1.200?
This feels very problematic to me and is causing me to have to hash
BigDecimal
values using a different technique than their realHash
impl.This test fails with
You can change
d1
andd2
to any two numbers that "end in" (or I guess, more accurately, have the significant digits) 1011, and you still get the panic, e.g. 10.11 or 0.00000001011 -- basically as long asdigits=[1011]
, you'll get the panic.It does not happen when you go in the other direction, like with 10110 because then you get
scale=0, digits=[10110]
, which hashes differently.Unless you use(I was mistaken about that; while normalizing do give them identical.normalized()
on them first; since you then get something likescale=-1, digits=[1011]
instead, which once more gives an identical hash,digits
, they still hash differently)The text was updated successfully, but these errors were encountered: