-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in clearBit #4
Comments
Hi @jvilar and thanks for reporting this bug. I think the bug is not in clearBit but in Current implementation of (.&.) is:
and I think it should instead be:
(Edited to fix typo in code snippet.) That is, for I need to properly test the change and if everything is OK I'll commit it, or you may open a pull request if you are in a hurry. |
Thank you for your prompt answer. However, I think that
But sign extending the operands risks having too many ones. Consider
which outputs On the other hand, if you worry about the repeated use of
Best regards, Juan Miguel |
Hi, The extra The main reason why I don't think
We could redefine Forgot to mention that one also needs to fix
so that Regarding your example:
This does work correctly, because Note that when you use I believe it makes sense that |
As I see it, there are two different issues here. First is whether the given equivalence is a law or a default implementation. From my point of view, it is an implementation since the meaning of The other issue is that according to the documentation of
And I fell that Best, Juan Miguel |
That is true, that is why I said that this would break backwards compatibility and would require a major version bump. The documentation would need to change too of course. I'm not saying that I have decided on this particular fix, but the fact that For your use of
It is of course a correct expression, as it is We can start by patching 0.5 with your latest proposal:
This can go into v0.5.1. But I am still considering to change |
Let me know if you can submit a pull request with that change, plus one or more QuickCheck properties about |
It will indeed because the change in Regarding the question of
Just done it. Best, Juan Miguel |
Fixed by 0aff564. |
The
clearBit
function does not work correctly. It currently uses the default implementation fromData.Bits
and the result is that all the bits above the one selected are also cleared. A possible solution is to define it explicitly using:Best regards,
Juan Miguel
The text was updated successfully, but these errors were encountered: