decimal
decimal copied to clipboard
Fixed #66: equal numbers issue different hashes
The idea is to use decQuadReduce()
function that eliminates insignificant zeroes from the number before hashing.
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 hey, sorry I don't follow. Are you asking whether trim
should be part of Rust API?
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
.
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.
@jonathanstrong is there a concern regarding usage of decNumberReduce()
?