-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
[doc/classes/int] fix description of operator '~' #75325
Conversation
I believe it's |
eb1b4c8
to
3b261b2
Compare
@AThousandShips thanks! ❤️ I updated it with the fixed syntax. |
You need to escape the arrows for html, |
Related: #70046. I didn't catch this mistake in particular, but there are other mistakes the PR fixes. As for this PR, I'm not too fond of the examples. I don't think we need that many of them, and the binary representations are also weird. Having only 6 bits to represent complement numbers is awkward, moreover I'm not sure if we should concern users with complement numbers in the first place. |
3b261b2
to
a77aee8
Compare
I tried running I now changed |
a77aee8
to
a89a0a0
Compare
I reduced the examples to just one positive and one negative. With regard to the word-length of the bit representation, since the sign is extended we can use any number of bits >=4. I'm good with using just 4 or 8, if 6 feels uncommon. With regard to concerning users with complement numbers, that's fundamental for understanding logical operations on integers. The mistake this PR fixes would be avoided if the binary representation had been written/reviewed. I find it possitive (not concerning) that the reference might trigger the curiosity of users expecting the more human readable but uncommon sign+magnitude or ones' complement. |
a7c91a3
to
b808651
Compare
My bad I should have been clear that it had to be the built version! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, except for a formatting issue.
b808651
to
971c534
Compare
I updated the comments to use the same literal syntax as in https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_basics.html#literals (six bits prefixed with 0b). I also replaced |
Superseded by #70046. Thanks for your contribution nevertheless! |
The description of the
~
operation in classint
is not correct. It states that a bitwise NOT operation results in-int + 1
. In fact, due to how 2's complement works, the operation results in-(int +1)
. This PR updates the description and fixes the examples in the codeblock.