Binary Number Operator A03

 ASCII (American Standard code for information interchange) is a 7bit character code with values from 0 to 127.

 Representing sound: sound needs to be converted into binary for the computer to be able to process it. sounds are usually captured by a microphone and then be converted into digital signals.

Representing colors:  image is broken into individual pixels. e.g., red = (255,0,0)

Representing numbers: numbers in a computer system is represented by a string of bits called binary numbers.

Number system: computer use binary numbers (base 2) to represent numbers also called transistor (on & off)

Decimal (base 10) system: numbers from 0 to 9. e.g., 823= 8x10^2+2x10^1x5x10^0

binary (base 2) system: numbers are 0 & 1. e.g., 1011=1x2^3+1x2^1+1= 11.

octa (base 8) system: numbers are 0 t0 7 e.g., 23=2x8^1+3=19

Hexadecimal (base 16) system: numbers from 0 to 9 and A to F. e.g., A12=10x16^2+1x16^1+2=2578

Number representation Unsigned.

If N numbers of bits, then 2^N-1. e.g., 3bits = 2^3-1=7

000 001 010 011 100 101 110 111

 Number representation Signed.

For signed integer the leftmost bit represents the sign

0 for positive

1 for negative


sign and magnitude 

1's compliment: obtained by complementing each bit of the corresponding bit.

e.g., 1001= 0110

2's compliment: obtained by forming bit of that number and adding 1. 

e.g., 1001=0110 +1= 0111

Addition

Four rules

0+0=0

0+1=0

1+1=10

1+1+1=11

e.g., 0010(+2)

      +0011(+3)

        0101(+5)

Subtraction

e.g., 1101(-3)     1101

       -1001(-7) = 0111

                          0100(+4)

Overflow

This occurs when the answer does not fit in the number range.

e.g., 1110

      +1001

     =10111

overflow occurs in 2 ways.

(+A) + (+B) = -C

(-A) + (-B) = +C





Comments

Popular posts from this blog

Introduction to Linux D02

Network Devices B02

Network Models C01