Download presentation
Presentation is loading. Please wait.
Published byOswald Wells Modified over 8 years ago
1
By Anand George SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
2
Binary Numbers The numbers we use in our daily life are called 10 based numerals. For example number 348 is equal to (3 x 100) + (4 x 10) + 8 While humans use 10 based numerals computers use 2 based numerals which as only 1 and 0 s in any number. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
3
Demo 10 based numerals and 2 based numeral in calc SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
4
Some Mapping of 10 based Numerals and 2 based Numerals. 10 based number2 base equivalent 00 11 210 311 4100 5101 6110 7111 81000 SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
5
Some jargons One digit of 2 based numeral is called a ‘bit’. 8 bits gives a byte 2 bytes or 16 bits give a word. 4 bytes or 32 bit gives a dword or doubleword. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
6
Some facts Any number can be expressed in 2 based numeral. A 2 based number of n digits can hold a number which has max value 2^n - 1 ( 2 to power n ) – 1. Everything you see or deal with in a computer – programs, video, music, your facebook page…. name it..all 1s and 0s…which is a 2 based number or collection of 2 based numbers. What makes the difference is the way different programs interpret the binary number. For example your facebook page is a big binary number which is interpreted by your browser as a web page and display it as a web page. Same big binary number can be something else to some other program or piece of code. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
7
Digital Operations on 2 based numbers. We do operations like addition, subtraction etc which decimal or 10 based numerals in a daily bases. 2 based numerals also has all those operations. 2 based numeral has some additional operations as well. AND, NOT, OR, NOR, XOR, Left Shift, Right Shift etc. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
8
AND operation Input operand 1Input operand 2AND Output 000 100 010 111 SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
9
OR Input operand 1Input operand 2OR Output 000 101 011 111 SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
10
Exclusive OR ( ExOR ) Input operand 1Input operand 2ExOR Output 000 101 011 110 SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
11
NOT or Ones complement ( unary operator as there is only one operand) Input operand 1NOT Output 01 10 SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
12
Shift operations Left Shift Right Shift OperationValue Initial0001 Left Shift by 1 bit0010 Left Shift by 1 bit0100 Left Shift by 1 bit1000 OperationValue Initial1100 Right Shift by 1 bit0110 Right Shift by 1 bit0011 Right Shift by 1 bit0001 SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
13
Demo Visual Studio Bitwise operation In C. OR | AND & NOT ^ Left Shift Right Shift SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
14
Operations ( cont ) These operations has some special physical means when it comes to 2 based numerals. Few Examples 1. AND has properties of Multiplication. 2. OR has properties of Addition 3. Left shift is equal to Multiplication by 2 4. Right shift is equal to division by 2 SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
15
Demo Show bit program SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
16
Hexadecimal Numbers. Has 16 Digits 0-9 then A, B, C, D, E, F No relation with computers. Easy to map to binary numbers. 0xDEADBEAD is a hex decimal 32 bit number. Conversion to binary is very easy as each just concatenate conversion of each digits. So most of the display of binary numbers in computers are via hex decimal to save space and better readability. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
17
Example conversion to binary 0xDEADBEAD 0x1234ABCD SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
18
Demo In calc.exe conversion. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
19
negative numbers 2’s compliment SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
20
Demo of 2’s compliment SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
21
Bit Fields struct myBits { bool first : 1; bool second : 1; bool third : 1; bool forth : 1; }; SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
22
Demo Bit Fields SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
23
Thank you SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.