decimal icon indicating copy to clipboard operation
decimal copied to clipboard

Fixed #66: equal numbers issue different hashes

Open spektom opened this issue 3 years ago • 5 comments

The idea is to use decQuadReduce() function that eliminates insignificant zeroes from the number before hashing.

spektom avatar Mar 07 '21 09:03 spektom

hey - just looking at this. thank you for submitting the pull request.

I did have one question, I'm not familiar with what trim/decNumberTrim does. I realize you switched to reduce, which makes sense, but is there an independent function of trim that we possibly want to offer for its own reasons?

jonathanstrong avatar Mar 09 '21 14:03 jonathanstrong

@jonathanstrong hey, sorry I don't follow. Are you asking whether trim should be part of Rust API?

spektom avatar Mar 09 '21 15:03 spektom

potentially? the C code has a comment describing decNumberTrim as "remove insignificant zeros", while the comment for decNumberReduce is "remove trailing zeros". I don't understand how these are different in terms of functionality, and would like to for the purposes of assessing whether the Rust api should also provide a trim method on d128.

jonathanstrong avatar Mar 09 '21 16:03 jonathanstrong

Frankly, I don't know. decNumberTrim is a utility function as it's called internally, I'm not sure it should be part of the API. Anyway, I don't think this decision should be made as part of this PR.

spektom avatar Mar 09 '21 18:03 spektom

@jonathanstrong is there a concern regarding usage of decNumberReduce()?

spektom avatar Mar 21 '21 09:03 spektom