Subtraction | Logical Redstone #12

preview_player
Показать описание

In this episode, I cover 2s complement representation and how to build a subtractor.

-------------------------

Want to get more involved in the logical redstone community?

0:00 Subtraction overview
0:43 Positive representation
1:30 Negative representation
4:02 Subtraction Examples
6:21 Building a Subtractor
7:14 Building a Toggleable Subtractor
8:42 Subscribe!

Рекомендации по теме
Комментарии
Автор

An explanation for the 'garbage' after the sign bit (first bit): In signed numbers (numbers that can represent negatives), I like to think of the first bit as having negative its normal value, so in a 4-bit signed integer, the bits from right to left would be: 1, 2, 4 and -8. For example, -3 would be 1101 because 3 = (-8) + 4 + 1.

We actually do this to ensure that each bit has the same value whether the value is positive or negative. If you were to represent a negative number with a 1 (sign bit) followed by the actual number, the rest of the bits will have negative value instead (-5 in this system would be 1101, or -1 * (4 + 1) = (-4) + (-1). This system makes numbers a lot harder to add because some numbers will have positive bit values and some would have negative values.

noooooob
Автор

Oh baby another. Love the conciseness, never a second unused. Really a great teaching/editing style. Best I’ve seen for these more complex topics

forrestberg
Автор

I’m studying IT at university, I understood two’s complement better in this video than in class

LMetal
Автор

This is also the meaning of the word "overflow": if the numbers are too high, computers can look at them as if they are negative. In Minecraft, the stacks sizes are stored in 8 bits. Because of this, the game allows stacks from -128 to 127!

caspermadlener
Автор

For those of you wanting to be able to read negative numbers in binary, you can treat the top bit as the negative of its normal value. For example, - 3 is (-8+5), or 1101.

samuelowens
Автор

The best part is the zoom in "No, absolutely not!" 🤣 As always fantastically clever video.

dragonsamuslive
Автор

About the unreadability, you can also read the negative as whatever the sign bit is supposed to be, and minus the rest of the number and add a negative at the front to get the value. For example, 1011 becomes 8-3=5. Therefore 1011 is -3

ahmadelkady
Автор

The "garbage" after the powered sign bit is actually 8 - that number. 1011 is -5 because 011 is 3 and 8 - 3 is 5.

aharsimajumdar
Автор

You can think of the sign bit as just having a value of -8 in the case of a 4-bit number, so 1010 is 1 * (-8) + 1 * 2 = -6

Zicrus
Автор

All your videos have helped me so much, I wasn’t good at all at redstone but I already working on a 8 bit calculator because of you.

sebbnebben
Автор

Dude! I've been waiting for somebody to go there, and you did it like a G! Thank you for making that sooo simple.

darth_dub_
Автор

if you treat the sign bit as -8, it becomes a lot easier to read the negative number

darrenmitchell
Автор

8:09 thats a really helpful trick with the xor gates. I was wondering what the best way to do that was. Thanks for helping me understand binary subtraction better! :)

imonocleman
Автор

Did you notice if you read the negative number grathic diagonally it gives you the positive number, I wounder if that's exsploitable like if you could some how diagonal parallel prosses the data you could get the positive number back out without needing to reverse the system, I wounder if you could reverse this system to get the answers faster and more intuitively using a simplified redstone circuit

dylanbeddoes
Автор

I think you can just imagine the last bit(sign bit) to be -8 and then it makes sense again...

prashant
Автор

cool, I thought getting absolute value from this was going to be super hard. I realize now that I can test for the signed bit and do the invert and add as needed depending on if it is positive or negative. These videos are single-handedly the most helpful for my project by far. thanks

MCChubbyUnicorn
Автор

This has actually helped me in my classes

HelPfeffer
Автор

i can see a pretty simple pattern in the negative number thing:
1011 = -5
if you treat the first bit as -8 instead of +8, and the rest of the bits as positive, they sum to the negative integer. like
-8 + 3 = -5

azavier-a
Автор

Man first I was 'nah this won't work', then opened minecraft, tried it by myself and somehow it worked
pure magic.

trelok
Автор

If the negative representation doesn’t make sense think of it this way (background):

The pos/neg number system he describes is called two’s compliment. In two’s compliment the negative numbers move in reverse.

The smallest positive number as you know at this point is all 0’s, on the negative side the smallest magnitude number is all 1’s (this means that’s the largest number on the negative side is also all 1’s).

We introduce 1’s to increase the value of positive numbers from right to left. We do the exact same to increase the value (not magnitude) numbers on the negative side.

The reason 2’s complement is chosen as the number system in most integrated circuits is because
1. It’s easy to inverse (neg -> pos -> neg)
2. In some other systems, there is a representation for both positive 0 and negative 0. This complicates comparisons. We only have 1 representation of 0 in 2’s complement which is good

kevinjerome