-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Incorrect (negative) values in safeRound result #134
Comments
when porting iteround, the different sorting methods were skipped in favor of diffing-only. apparently I overshot the mark a bit in deleting supposedly unused code paths. This should bring the implementation a good deal closer to the original and compensate for corresponding deviations. contributes to #134
Well, I guess I removed too much comparing with the original implementation. Pushed a bug fix that should align it. At least your test became green and while the order of things changed, the sum-result remained stable throughout the pre-exising tests. |
Thanks for the swift reaction. The suggested regression test is now green. It was my understanding that saferound tries to produce the same results as iteround. However, after this change that's not the case for the pre-existing example in the test suite
nor for the example of the iteround package
Is there a misunderstanding? Thanks! |
Yes, it was meant to be copy of the "DIFFERENCE" strategy of iteround. Perhaps I have overseen a sorting or something. Feel free to raise a PR ;-) |
nvm, I think I have been able to fix it so, that the original basic difference test as well as the readme example are green. |
the original library contains a "reverse" mechanism, that influences which element is being rounded next. added tests proving that it aligns with the readme example and the examples from the "basic_difference" test. contributes to #134
Thanks for your work! That last change addressed our concerns. |
For certain inputs (not entirely sure what they have in common) we are seeing results which do seem off and do not match Iteround's results for the same input.
Interestingly, a correct sum seems to be achieved by negative and positive values compensating for one another.
Please find a reproduction at https://github.com/wiese/saferound/commit/0bacbbc99c3853f7d28711e02b6f108c4c298092
The iteround equivalent (codesandbox here):
Please advise, am I missing something? Thank you!
The text was updated successfully, but these errors were encountered: