Last active
June 9, 2017 20:42
-
-
Save tennisonchan/930620c93d4f3e7c70c448d57735ed60 to your computer and use it in GitHub Desktop.
Binary of a negative number
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators | |
(-3 >>> 0).toString(2) | |
// 11111111111111111111111111111101 => -3 | |
(-9 >>> 2).toString(2) | |
// 00111111111111111111111111111101 => 1073741821 | |
(-9 >> 2).toString(2) | |
// 11111111111111111111111111111101 => -3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment