Lesson 6.1 : Basics of signed and unsigned numbers

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 พ.ย. 2024

ความคิดเห็น • 114

  • @danielj.7656
    @danielj.7656 3 ปีที่แล้ว +29

    Nearly 9 years after the original upload date, and this still helped me a bunch. Thank you

  • @sang180
    @sang180 11 ปีที่แล้ว +1

    I like my computer science teacher but gotta admit he is not the clearest lecturer. Your videos are clear, concise, to the point. Thanks SO much.

  • @agiliteaV
    @agiliteaV 2 ปีที่แล้ว +2

    My classes just skimmed over this real quickly, I thank this video for being avalible for me to better understand this concept. Thank you.

  • @utopianice4574
    @utopianice4574 6 ปีที่แล้ว +79

    "So I want to explore this a 'bit' more" hehehe

    • @drbudman8768
      @drbudman8768 3 ปีที่แล้ว +3

      Get out...👉🤣

  • @amrfarag8308
    @amrfarag8308 9 ปีที่แล้ว +29

    The positive values are easy: 0 = 0000 1 = 0001 2 = 0010 3 = 0011 4 = 0100 5 = 0101 6 = 0110 7 = 0111
    For the negative values, you need the 2's complement (invert all the bits, then add "1")
    -1 = 1110 + 1 = 1111
    -2 = 1101 + 1 = 1110
    -3 = 1100 + 1 = 1101
    -4 = 1011 + 1 = 1100
    -5 = 1010 + 1 = 1011
    -6 = 1001 + 1 = 1010
    -7 = 1000 + 1 = 1001
    The only combination not yet used in either positive or negative values is "1000" This could equal either 8 or -8, so in keeping with the sign bit convention, -8 is used. So, signed 4-bit binary gives you the values -8 to 7. Similarly, signed 8-bit binary give you -128 to 127 and signed 16-bit binary give -32768 to 32767.

    • @AdamDavis444
      @AdamDavis444 9 ปีที่แล้ว

      +Amr Farag Excellent clarification, also on the non-duplication of zero. Thanks!

    • @ah.maaher
      @ah.maaher 6 ปีที่แล้ว

      +Amr Farag
      اشرح الكلام ده تانى كدا
      For the negative values, you need the 2's complement (invert all the bits, then add "1")
      -1 = 1110 + 1 = 1111
      -2 = 1101 + 1 = 1110
      -3 = 1100 + 1 = 1101
      -4 = 1011 + 1 = 1100
      -5 = 1010 + 1 = 1011
      -6 = 1001 + 1 = 1010
      -7 = 1000 + 1 = 1001

  • @notsocooljoe
    @notsocooljoe 2 ปีที่แล้ว +4

    This is amazing. You just taught me something I couldn't grasp by other teachers.

  • @sang180
    @sang180 11 ปีที่แล้ว +14

    Awesome teaching style. Super clear, super concise. Thanks!!!

  • @CliffordFajardo
    @CliffordFajardo 5 ปีที่แล้ว +2

    I liked the small examples & summary slides. Also liked how you threw in other information like:
    - "keep in mind it is up to you the programmer to specify how any given binary sequence is going-to be interpreted" ...
    In the comments below someone mentioned 2's compliment, which is something I'd heard mentioned in the past, but never really looked into.
    Essentially there are several ways to represent signed numbers (positive or negative numbers). One method is by using the signed magnitude method ( using a sign bit ..shown in this video) and complement form (1 & 2s complement)

  • @darraghrabbitte1772
    @darraghrabbitte1772 2 ปีที่แล้ว

    Thanks for this , a video made 10 years ago taught me in 10 mins what a college lecturer failed to do in 4 weeks!

  • @jiji5493
    @jiji5493 3 ปีที่แล้ว +2

    it’s so crazy seeing these comments thanking him not knowing what he did

    • @patduenas2179
      @patduenas2179 2 ปีที่แล้ว +3

      I went down the rabbit hole… 😧😧😱

  • @ericjunior105
    @ericjunior105 2 ปีที่แล้ว

    10 years down the line and this is still useful

  • @jonsanmigel4226
    @jonsanmigel4226 3 ปีที่แล้ว

    Brooooooooo, This is soooo much more clear than my current professor thank you!!!

  • @carlherold4026
    @carlherold4026  12 ปีที่แล้ว +5

    What happens is that rather than counting a positive zero and a negative zero, you get one extra negative number. For example, a 16 bit signed integer would hold values from -32,768 to positive 32,767.

    • @fakhraaslam296
      @fakhraaslam296 6 ปีที่แล้ว

      i still confuse.............. how i know about number is signed or not

    • @Josama0214
      @Josama0214 4 ปีที่แล้ว +1

      M8 he’s in jail

  • @GroudFrank
    @GroudFrank 10 ปีที่แล้ว +3

    *Excellent!* I was having problems understanding this but I practiced binary exorcises converting binary to decimal and hexadecimal, or converting hexadecimal to decimal and binary etc. Now I completely understand all that was said in the video.

  • @blaincaptures3541
    @blaincaptures3541 4 ปีที่แล้ว

    My professor is an Asian man who speaks terrible english, I can't understand a word he says. This video is very helpful

  • @therealpepeu
    @therealpepeu 5 ปีที่แล้ว +3

    Thank you! I finally got this bit into my brain.

  • @eggplantunleashed4740
    @eggplantunleashed4740 4 ปีที่แล้ว +8

    Why do most Computer Tutorials sound like there's some Huge Ass Server running in the background? Lol.
    Thank you so much for this video! This is so easy to understand with your instructions. Subbed!

    • @IFoundAUsername2
      @IFoundAUsername2 4 ปีที่แล้ว

      subbed although he hasn't posted in 6 years XD

    • @tobyliebke142
      @tobyliebke142 4 ปีที่แล้ว

      @@IFoundAUsername2 www.nydailynews.com/news/crime/alabama-man-raped-videotaped-sonin-interstate-child-porn-ring-prosecutors-article-1.1549914

    • @tobyliebke142
      @tobyliebke142 4 ปีที่แล้ว

      @@IFoundAUsername2 Would probs unsub

  • @WVJimbo
    @WVJimbo 10 ปีที่แล้ว +4

    So why would TH-cam use a signed 32-bit integer to represent the total number of views for a video instead of an unsigned integer? When would they ever need to record a negative number of views? There must have been some benefit of using a signed integer but I can't imagine what that would be.

    • @fyrstikken
      @fyrstikken 10 ปีที่แล้ว +1

      hmm, well, unsigned integer would only delay the problem of the max view limit. Upgrading to 64 bit is just the logical next step to do, but ofc - yes, they could use unsigned integer, and have the view-counts run for many more years with only positive numbers to display.

  • @WaldoTheWombat
    @WaldoTheWombat 2 ปีที่แล้ว

    what is the alternative for representing negative values? and what is compliment?

  • @dhwajgoyal
    @dhwajgoyal 11 ปีที่แล้ว +1

    Why do you get an extra negative and not extra positive number instead? Just a conventional way or does it hold a special purpose?

  • @stevenrogersfineart4224
    @stevenrogersfineart4224 2 ปีที่แล้ว

    This is an excellent video. You might want to look into Nvidia broadcast or something like that for background noise canceling. If it didn't have that background noise this video would be A+

  • @MM-by6qq
    @MM-by6qq 3 ปีที่แล้ว +1

    OMG thanks alot sir!!! that was perfect explanation

  • @d3magol9
    @d3magol9 3 ปีที่แล้ว

    Explained fantastically. Keep it up.

    • @luzherrera4463
      @luzherrera4463 2 ปีที่แล้ว

      He killed himself

    • @d3magol9
      @d3magol9 2 ปีที่แล้ว +1

      @@luzherrera4463 ?

  • @oussamaboukoutaya8702
    @oussamaboukoutaya8702 ปีที่แล้ว

    You are great, i hope you are doing good ❤❤

  • @hasnatkabir8903
    @hasnatkabir8903 6 ปีที่แล้ว +14

    all confusion gone away.

  • @sharpEAGLES
    @sharpEAGLES 10 ปีที่แล้ว +1

    Consider a number line for this concept it will get clear.

  • @orangeflip
    @orangeflip 7 ปีที่แล้ว +1

    some of the people in the comments are getting mixed up between sign and magnitude, using leftmost bit as a sign, and 2's compliment.

  • @evagorasioannou7505
    @evagorasioannou7505 10 ปีที่แล้ว

    thank goodness for your video. Couldn't have been explained more clearly. Thanks very much.

  • @alexg.1465
    @alexg.1465 4 ปีที่แล้ว +3

    3:12 i want to explore this a "bit" more

  • @VISHESHKUSHWAH
    @VISHESHKUSHWAH 10 ปีที่แล้ว

    I have a doubt,just have u said that if int x=1010,then signed x is -2,it could be +10 also ,as the result should depend on the no. of bits of x.

  • @altafsheikh3485
    @altafsheikh3485 9 ปีที่แล้ว +3

    very nicely explained thank you

  • @adrianasilveira4561
    @adrianasilveira4561 3 ปีที่แล้ว

    Great video. Thank you

  • @JLee14
    @JLee14 6 ปีที่แล้ว +1

    Thank you for explaining so well!

  • @apexant8957
    @apexant8957 9 ปีที่แล้ว +5

    explained well.

  • @feitoza.system
    @feitoza.system 2 ปีที่แล้ว

    thank you very much, man.

  • @WhatupPlayboy
    @WhatupPlayboy 2 ปีที่แล้ว

    Awesome man
    I get it the idea 💡

  • @ps4bros934
    @ps4bros934 2 ปีที่แล้ว +1

    really clear

  • @eandyil8168
    @eandyil8168 8 ปีที่แล้ว +2

    For those of you confused as I was, the reddit thread has explained it in comments. For those of you starting this after me, you'll have figured out I'm following reddit and youtube as I go.
    www.reddit.com/r/carlhprogramming/comments/9os31/lesson_18_the_basics_of_signed_and_unsigned/

  • @razbenhaim6651
    @razbenhaim6651 4 ปีที่แล้ว +1

    summary: 7:50

  • @oddball0045
    @oddball0045 11 ปีที่แล้ว +2

    Yes, known as 2's complement

  • @himbary
    @himbary 6 ปีที่แล้ว

    This helped me a lot thanks!

  • @kqvanity
    @kqvanity 3 ปีที่แล้ว

    8:20 not respectively in this case , inversely as far as i understand

  • @nicklasnilsson8217
    @nicklasnilsson8217 10 ปีที่แล้ว

    Awesome explanation!

  • @hastar4329
    @hastar4329 3 ปีที่แล้ว

    great video

  • @OriginalLany
    @OriginalLany 7 ปีที่แล้ว +1

    Well, thanks for the video, but..
    5:45 binary 0011 is 3, that's okay
    But 1011 is actually not negative 3, that's negative 5..

  • @420nyk
    @420nyk 4 ปีที่แล้ว

    Great Video. Thanks a ton!

    • @TheBatmanvs1
      @TheBatmanvs1 4 ปีที่แล้ว +1

      Did you hear what he did?

    • @420nyk
      @420nyk 4 ปีที่แล้ว

      @@TheBatmanvs1 Yes

  • @hirakmondal6174
    @hirakmondal6174 7 ปีที่แล้ว +1

    1011 is also negative three and eleven???
    how is this possible? i am totally confused..pls help

    • @matocarina
      @matocarina 6 ปีที่แล้ว +1

      yes,that's way you can't know data type just by looking at it 0:35

  • @AgentGWG
    @AgentGWG 5 ปีที่แล้ว +26

    Literally no one is talking about how terrible of a person this guy was!
    Like yeah, this video might have helped you learn something, but he was a maniac, so keep your praise to yourself.

    • @brianzhamilton
      @brianzhamilton 5 ปีที่แล้ว +10

      Grant Gammon Wow.... if not for your comment here, I never would have known.

    • @Rakesh-yu1pb
      @Rakesh-yu1pb 4 ปีที่แล้ว +5

      holy shit i just googled his name wtf

    • @radiagulzan
      @radiagulzan 4 ปีที่แล้ว +3

      omg is this the same person? www.inquisitr.com/1069377/carl-herold-popular-reddit-user-carlh-accused-of-raping-torturing-9-year-old-son/

    • @pjk7685
      @pjk7685 4 ปีที่แล้ว +7

      @@radiagulzan omg this is crazy. But it reminds me of something my philosophy teacher said. A evil person can state facts. Doesn't mean you automatically have to discredit every word from his mouth/ such as facts of whatever he's teaching. You can discredit his character and even be repulsed by it. It's important to separate the two. Although I do hope he gets the punishment he deserves and is put in jail for life and suffers for such horrendous repulsive crimes. However his video is not a crime so I will try to understand this video topic at hand even though I am really disturbed about this person's mental well being now.

    • @yuesesdiapp9804
      @yuesesdiapp9804 4 ปีที่แล้ว +3

      @@pjk7685 Thank you for bringing that up. This is insane!! I am only here to learn about this certain topic but it gave me the chills.

  • @subashacharya2682
    @subashacharya2682 10 ปีที่แล้ว +1

    best best
    thanks i was trying to understand it

  • @adgritty5222
    @adgritty5222 8 ปีที่แล้ว

    is there any android code pads available ...!? plz someone answer's me

  • @coreprogramming
    @coreprogramming 11 ปีที่แล้ว

    and for 32 bit complir it is ??????

  • @oddball0045
    @oddball0045 11 ปีที่แล้ว

    Actually my bad, this is sign magnitude. But i generally like 2's complement better.

  • @UKImperium
    @UKImperium 4 ปีที่แล้ว

    Thank you. Even though this is still a little confusing it helped.

    • @theanimationlads7598
      @theanimationlads7598 3 ปีที่แล้ว +2

      He’s literally been dead for like 6 years

    • @UKImperium
      @UKImperium 3 ปีที่แล้ว +2

      @@theanimationlads7598 . I didn't know. After you said that I decided to Google his name. I can't believe what I read.

  • @kshitijvengurlekar1192
    @kshitijvengurlekar1192 7 ปีที่แล้ว +1

    Thanks a lot

  • @youngchrisymcmb
    @youngchrisymcmb 7 ปีที่แล้ว

    Very awesome!

  • @shuyanchi5224
    @shuyanchi5224 6 ปีที่แล้ว +1

    it's great.

  • @cristiangarcia22barc
    @cristiangarcia22barc 5 ปีที่แล้ว

    perfect thank you

  • @arunbm123
    @arunbm123 6 ปีที่แล้ว

    well explained

  • @nawal7254
    @nawal7254 4 ปีที่แล้ว

    how do you know what number it is?

    • @RayGBullet
      @RayGBullet 4 ปีที่แล้ว

      He ain't gonna reply chief. My nigga is burning in hell.

    • @nawal7254
      @nawal7254 4 ปีที่แล้ว +1

      @@RayGBullet yo it's been 6months lmao dont even remember this video just glad I passed the semester 😩

    • @aishamohammed5628
      @aishamohammed5628 3 ปีที่แล้ว +1

      @@nawal7254 Hey are u somali?

    • @nawal7254
      @nawal7254 3 ปีที่แล้ว

      @@aishamohammed5628 Sudanese

    • @nawal7254
      @nawal7254 3 ปีที่แล้ว

      Lmao a year now 😂

  • @CrashRebootL3
    @CrashRebootL3 10 ปีที่แล้ว

    thanks, good to know

  • @mryup6100
    @mryup6100 5 ปีที่แล้ว +1

    3:10 Nice pun sir...

  • @VkXGames
    @VkXGames 6 ปีที่แล้ว

    ¡EXCELENT! ¡Thanks!

  • @GurnBograt1986
    @GurnBograt1986 10 ปีที่แล้ว

    Awesome!

  • @itaco8066
    @itaco8066 4 ปีที่แล้ว

    Awesome

  • @6183134
    @6183134 4 ปีที่แล้ว

    Excelent!!!!!!

  • @markolovric8237
    @markolovric8237 10 ปีที่แล้ว

    isn't 1111 negativ 0?

  • @coleblezzy9755
    @coleblezzy9755 10 ปีที่แล้ว

    good vid but get rid of all the background noise

  • @animania6947
    @animania6947 5 ปีที่แล้ว

    Playback speed 2x

  • @mallemang
    @mallemang 9 ปีที่แล้ว +2

    also 1010 is NOT negative two!
    it looks more like negative six to me.

    • @brown6532
      @brown6532 8 ปีที่แล้ว +8

      It's negative 2 in signed number..
      The first bit is reserved for the sign

  • @passingby1350
    @passingby1350 3 ปีที่แล้ว

    "this number is obviously 7" :"0

  • @uraniumcivics7144
    @uraniumcivics7144 6 ปีที่แล้ว

    #dickgamestrong

  • @SalaciousBCrumb-te1jx
    @SalaciousBCrumb-te1jx 7 ปีที่แล้ว

    NNEERRRRRRDSS

  • @tuxsax
    @tuxsax 12 ปีที่แล้ว +2

    Hi Carl,
    A little question about the signed numbers, what happens to zero? There's no positive nor negative zero, so it means we're wasting four bits for nothing, right? as we're counting twice zero as it can be only one value for zero.

    • @charliea2096
      @charliea2096 3 ปีที่แล้ว

      I don’t think he’s going to respond any time soon

  • @AmusingG69
    @AmusingG69 2 ปีที่แล้ว +1

    @amps sup

  • @tuxsax
    @tuxsax 12 ปีที่แล้ว +1

    I see, so you basically skip the negative zero and start counting right away from -1 to -32768?
    Cool, no bits waste...

  • @ps4bros934
    @ps4bros934 2 ปีที่แล้ว +1

    Awesome teaching style. Super clear, super concise. Thanks!!!

    • @malo.8948
      @malo.8948 2 ปีที่แล้ว +1

      look up his name, you'd be surprised...