I recently found the #TwosComplement #podcast by @benrady and @mattgodbolt. Their episode on #Golf reminds me of work I've seen on #Darts, and figuring out where players of varying skill levels should aim to maximise their chances. https://www.twoscomplement.org/#podcast/golf-for-hackers
Also, I now want to have at least one round of terrible golf. Any Fedigolfers near me who are willing to risk the wrath of the greens keepers and show me what to do / let me desecrate their holy course by pouring cursed ineptitude all over it?
Understanding Two's Complement
In the world of digital electronics and computing, dealing with negative binary numbers is a crucial task. This is where the concept of two's complement comes into play. Twos complement calculator is a mathematical operation used to represent both positive and negative binary numbers within the same number of bits.
So how does it work? Let's take an 8-bit binary number as an example. To obtain the two's complement of a positive number, you simply represent it as is. For a negative number, you follow these steps:
1. Take the absolute value of the number and represent it in binary.
2. Flip all the bits (change 0 to 1 and 1 to 0).
3. Add 1 to the flipped value.
The resulting binary value is the two's complement representation of the negative number.
Two's complement is widely used in modern computers and digital circuits because it simplifies arithmetic operations involving both positive and negative numbers. It eliminates the need for separate logic to handle positive and negative values, making computations more efficient.
While the concept may seem abstract at first, understanding two's complement is crucial for anyone delving into the intricacies of computer architecture, digital electronics, or low-level programming.
Reference:https://twoscomplementcalculator.com/
#TwosComplement #BinaryArithmetic #DigitalLogic #ComputerArchitecture
For example, consider the 8-bit two's complement representation: To represent +5, we simply represent it as 00000101. To represent -5, we take the binary representation of 5 (00000101), invert all the bits to get 11111010, and then add 1 to get 11111011, which is the two's complement representation of -5.
This is often useful for finding the most commonly occurring lines in a file using the #linux #commandline
https://gist.github.com/sjaturner/a42a791bd61f41c4bff414bf1ec1922d
I seem to recall this mentioned on an episode of #twoscomplement - its surprising how useful this technique is.
It's handy for logfile analysis - sometimes the lowest frequency entries are the most significant. You can squish out numerical information using sed or tr which can help, too.
https://gist.github.com/sjaturner/a42a791bd61f41c4bff414bf1ec1922d