[PDF] [PDF] Computer Fundamentals: Number Systems Dr Robert Harle

Decimal Number System □ Most computers count in binary, which we can easily understand from the decimal so ingrained in us 35462 



Previous PDF Next PDF





[PDF] Computer Number System - Tutorialspoint

understand only numbers A computer can understand positional number system where there are only a few symbols called digits and these symbols represent 



[PDF] Computer Fundamentals: Number Systems Dr Robert Harle

Decimal Number System □ Most computers count in binary, which we can easily understand from the decimal so ingrained in us 35462 



[PDF] NUMBER SYSTEM CONVERSIONS - ipsgwaliororg

Number systems are the technique to represent numbers in the computer system architecture, A Binary number system has only two digits that are 0 and 1



[PDF] Introduction To Number and Computer Systems

hexadecimal digit corresponds to four binary digits The first 16 numbers in the decimal, binary, octal, and hexadecimal number systems are listed in Table 1-2



[PDF] 1 Number System (Lecture 1 and 2 supplement)

Studying number systems can help you understand the basic computing processes by digital systems 1 1 Positional Number Systems A good example of  



[PDF] FUNDAMENTAL OF COMPUTERS 11 Introduction 12 Application

number system is essential to understand the operation of a computer days data used to maintain using the traditional or manual record keeping system



[PDF] Chapter 3-Number System - BCA Notes

Computer Fundamentals: Pradeep K Sinha Priti Sinha Slide 3/40 Chapter 3: Number Systems Ref Page § Convert a number's base § Another base to 



[PDF] Number Systems and Number Representation - Cs Princeton

Name • “binarius” (Latin) => two Characteristics • Two symbols • 0 1 • Positional • 1010 B ≠ 1100 B Most (digital) computers use the binary number system



[PDF] Number Systems

as hexadecimal digits 14 Introduction to Computer Science, Fall, 2010 The Hexadecimal System (base 16)



[PDF] Number Systems and Codes

Therefore, computers must perform mathematical operations using the binary number system and must represent alphanumeric information using binary codes To 

[PDF] number system lecture notes pdf

[PDF] number theory congruence problems and solutions

[PDF] number to letter decrypter

[PDF] numbered list apa format example

[PDF] number_of_reviews_ltm

[PDF] numeric attributes in data mining

[PDF] numerical analysis 1

[PDF] numerical analysis 1 pdf

[PDF] numerical analysis book for bsc

[PDF] numerical analysis book pdf by b.s. grewal

[PDF] numerical analysis book pdf by jain and iyengar

[PDF] numerical analysis books indian authors

[PDF] numerical analysis bsc 3rd year

[PDF] numerical analysis handwritten notes pdf

[PDF] numerical analysis pdf download

Computer Fundamentals:

Number Systems

Dr Robert Harle

Today's Topics

yThe significance of the bit and powers of 2 yData quantities (B, kB, MB, GB, etc) yNumber systems (decimal, binary, octal , hexadecimal) yRepresenting negative numbers (sign-magnitude, 1's complement, 2's complement) yBinary addition (carries, overflows) yBinary subtraction So... yWhat is a bit?

The Significance of the Bit

yA bit (Binary digIT) is merely 0 or 1 yIt is a unit of information since you cannot communicate with anything less than two states yThe use of binary encoding dates back to the 1600s with Jacquard's loom, which created textiles using card templates with holes that allowed needles through

Bits and Computers

yThe nice thing about a bit is that, with only two states, it is easy to embody in physical machinery yEach bit is simply a switch and computers moved from vacuum tubes to transistors for this e-

Decimal Number System

yMost computers count in binary, which we can easily understand from the decimal so ingrained in us 35462

Decimal Number System

yMost computers count in binary, which we can easily understand from the decimal so ingrained in us

354622x100

Decimal Number System

yMost computers count in binary, which we can easily understand from the decimal so ingrained in us

354622x1006x101+

Decimal Number System

yMost computers count in binary, which we can easily understand from the decimal so ingrained in us

354622x1006x101+4x102+

Decimal Number System

yMost computers count in binary, which we can easily understand from the decimal so ingrained in us

354622x1006x101+4x102+5x103+

Decimal Number System

yMost computers count in binary, which we can easily understand from the decimal so ingrained in us

354622x1006x101+4x102+5x103+3x104+

Binary

yBinary is exactly the same, only instead of ten digits/states (0 to 9) we have just two, so the base becomes 2:

101100x201x21+1x22+0x23+1x24+

Binary

yBinary is exactly the same, only instead of ten digits/states (0 to 9) we have just two, so the base becomes 2:

10110b = 22d0x201x21+1x22+0x23+1x24+

Binary

yBinary is exactly the same, only instead of ten digits/states (0 to 9) we have just two, so the base becomes 2:

10110b = 22d0x201x21+1x22+0x23+1x24+

Most Signiificant

Bit (MSB)Least Signiificant

Bit (LSB)

Works for Fractional Numbers too...

35.4622x10-36x10-2+4x10-1+5x100+3x101+

Works for Fractional Numbers too...

10.110b = 2.75d0x2-31x2-2+1x2-1+0x20+1x21+35.4622x10-36x10-2+4x10-1+5x100+3x101+

Check

11.011b

Check

11.011b = 3.375d1x2-31x2-2+0x2-1+1x20+1x21+

Representable Numbers

yWith d decimal digits, we can represent 10d different values, usually the numbers 0 to (10d-1) inclusive yIn binary with n bits this becomes 2n values, usually the range 0 to (2n-1) yComputers usually assign a set number of bits (physical switches) to an instance of a type. yAn integer is often 32 bits, so can represent positive integers from 0 to 4,294,967,295 incl. yOr a range of negative and positive integers...

Other Common Bases

yHigher bases make for shorter numbers that are easier for humans to manipulate. e.g.

6654733d=11001011000101100001101b

yWe traditionally choose powers-of-2 bases because this corresponds to whole chunks of binary

Other Common Bases

yHigher bases make for shorter numbers that are easier for humans to manipulate. e.g.

6654733d=11001011000101100001101b

yWe traditionally choose powers-of-2 bases because this corresponds to whole chunks of binary yOctal is base-8 (8=23 digits, which means 3 bits per digit) y6654733d=011-001-011-000-101-100-001-101b= 31305415o

Other Common Bases

yHigher bases make for shorter numbers that are easier for humans to manipulate. e.g.

6654733d=11001011000101100001101b

yWe traditionally choose powers-of-2 bases because this corresponds to whole chunks of binary yOctal is base-8 (8=23 digits, which means 3 bits per digit) y6654733d=011-001-011-000-101-100-001-101b= 31305415o yHexadecimal is base-16 (16=24 digits so 4 bits per digit) yOur ten decimal digits aren't enough, so we add 6 new ones: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F

Other Common Bases

yHigher bases make for shorter numbers that are easier for humans to manipulate. e.g.

6654733d=11001011000101100001101b

yWe traditionally choose powers-of-2 bases because this corresponds to whole chunks of binary yOctal is base-8 (8=23 digits, which means 3 bits per digit) y6654733d=011-001-011-000-101-100-001-101b= 31305415o yHexadecimal is base-16 (16=24 digits so 4 bits per digit) yOur ten decimal digits aren't enough, so we add 6 new ones: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F yBecause we constantly slip between binary and hex, we have a special marker for it yPrefix with '0x' (zero-x). So 0x658B0D=6654733d, 0x123=291d Bytes yA byte was traditionally the number of bits needed to store a character of text yA de-facto standard of 8 bits has now emerged y256 values y0 to 255 incl. yTwo hex digits to describe y0x00=0, 0xFF=255 yCheck: what does 0xBD represent? Bytes yA byte was traditionally the number of bits needed to store a character of text yA de-facto standard of 8 bits has now emerged y256 values y0 to 255 incl. yTwo hex digits to describe y0x00=0, 0xFF=255 yCheck: what does 0xBD represent? yB → 11 or 1011 yD → 13 or 1101 yResult is 11x161+13x160 = 189 or 10111101

Larger Units

yStrictly the SI units since 1998 are: yKibibyte (KiB) y1024 bytes (closest power of 2 to 1000) yMebibyte (MiB) y1,048,576 bytes yGibibyte (GiB) y1,073,741,824 bytes

Larger Units

yStrictly the SI units since 1998 are: yKibibyte (KiB) y1024 bytes (closest power of 2 to 1000) yMebibyte (MiB) y1,048,576 bytes yGibibyte (GiB) y1,073,741,824 bytes ybut these haven't really caught on so we tend to still use the SI Kilobyte, Megabyte, Gigabyte. This leads to lots of confusion since technically these are multiples of 1,000.

The Problem with Ten

Unsigned Integer Addition

yAddition of unsigned integers works the same way as addition of decimal (only simpler!) y0 + 0 = 0 y0 + 1 = 1 y1 + 0 = 1 y1 + 1 = 0, carry 1 yOnly issue is that computers have fixed sized types so we can't go on adding forever... 111
+ 001001 + 001

Carry lflag:Carry lflag:

Modulo or Clock Arithmetic

yOverflow takes us across the dotted boundary ySo 7+1=0 (overflow) yWe say this is (7+1) mod 8 000 001 010

011100101110111000

001 010 011 100
101
110
111

Negative Numbers

yAll of this skipped over the need to represent negatives. yThe naïve choice is to use the MSB to indicate +/- y1 in the MSB → negative y0 in the MSB → positive yThis is the sign-magnitude technique-7 = 1111

NegativeNormal positive

representation of 7

Difficulties with Sign-Magnitude

yHas a representation of minus zero (10002=-0) so wastes one of our 2n labels yAddition/subtraction circuitry must be designed from scratch 1101
+ 0001 1110

Our unsigned addition alg.

Difficulties with Sign-Magnitude

yHas a representation of minus zero (10002=-0) so wastes one of our 2n labels yAddition/subtraction circuitry must be designed from scratch 1101
+ 0001 1110

Our unsigned addition alg.+13

+1 +14

Unsigned

interpretation

Difficulties with Sign-Magnitude

yHas a representation of minus zero (10002=-0) so wastes one of our 2n labels yAddition/subtraction circuitry must be designed from scratch 1101
+ 0001

1110-5

+1 -6+13 +1 +14

Sign-mag

interpretationUnsigned interpretation

Our unsigned addition alg.

Alternatively...

yGives us two discontinuities and a reversal of direction using normal addition circuitry!! 000 001 010

011100101110111000

001 010 011 100
101
110
111

Ones' Complement

yThe negative is the positive with all the bits flipped y7 → 0111 so -7 → 1000 yStill the MSB is the sign yOne discontinuity but still -0 :-( 000 001 010

011100101110111000

001 010 011 100
101
110
111

Two's Complement

yThe negative is the positive with all the bits flipped and 1 added (the same procedure for the inverse) y7 → 0111 so -7 → 1000+0001 → 1001 yStill the MSB is the sign yOne discontinuity and proper ordering 000 001 010 011 100
101
110
111
000 001 010

011100101110111

Two's Complement

yPositive to negative: Invert all the bits and add 1 yNegative to positive: Same procedure!!

1011 (-5) → 0100 → 0101 (+5)0101 (+5) → 1010 → 1011 (-5)

Signed Addition

1101
+0001 1110
Our unsigned addition alg.y...it just works with our addition algorithm! +13 +1 +14

Unsigned

Signed Addition

1101
+0001

1110-3

+1 -2+13 +1 +14

2's-compUnsigned

Our unsigned addition alg.y...it just works with our addition algorithm!

Signed Addition

1101
+0001

1110-3

+1 -2+13 +1 +14

2's-compUnsigned

Our unsigned addition alg.y...it just works with our addition algorithm! ySo we can use the same circuitry for unsigned and 2s- complement addition :-) yWell, almost.Signed Addition 0100
+0100

1000+4

+4 +8

UnsignedCarry lflag: 0

ySo we can use the same circuitry for unsigned and 2s- complement addition :-) yWell, almost. yThe problem is our MSB is now signifying the sign and our carry should really be testing the bit to its right :-(Signed Addition 0100
+0100

1000+4

+4 -8+4 +4 +8

2's-compUnsignedCarry lflag: 0

ySo we can use the same circuitry for unsigned and 2s- complement addition :-) yWell, almost. yThe problem is our MSB is now signifying the sign and our carry should really be testing the bit to its right :-( ySo we introduce an overflow flag that indicates this problemSigned Addition 0100
+0100

1000+4

+4 -8+4 +4 +8

2's-compUnsignedCarry lflag: 0

Overlflow: 1

Integer subtraction

yCould implement the "borrowing" algorithm you probably learnt in school yBut why bother? We can just add the

2's complement instead.

0100
- 0011 0100
+1101

0001→

Flags Summary

yWhen adding/subtracting yCarry flag → overflow for unsigned integer yOverflow flag → overflow for signed integer yThe CPU does not care whether it's handling signed or unsigned integers yDown to our compilers/programs to interpret the result

Fractional Numbers

yScientific apps rarely survive on integers alone, but representing fractional parts efficiently is complicated. yOption one: fixed point ySet the point at a known location. Anything to the left represents the integer part; anything to the right the fractional part yBut where do we set it?? yOption two: floating point yLet the point 'float' to give more capacity on its left or right as needed yMuch more efficient, but harder to work with yVery important: more in Numerical Methods course

Computer Fundamentals:

Number Systems

Dr Robert Harle

Today's Topics

yThe significance of the bit and powers of 2 yData quantities (B, kB, MB, GB, etc) yNumber systems (decimal, binary, octal , hexadecimal) yRepresenting negative numbers (sign-magnitude, 1's complement, 2's complement) yBinary addition (carries, overflows) yBinary subtraction So... yWhat is a bit?

The Significance of the Bit

yA bit (Binary digIT) is merely 0 or 1 yIt is a unit of information since you cannot communicate with anything less than two states yThe use of binary encoding dates back to the 1600s with Jacquard's loom, which created textiles using card templates with holes that allowed needles through

Bits and Computers

yThe nice thing about a bit is that, with only two states, it is easy to embody in physical machinery yEach bit is simply a switch and computers moved from vacuum tubes to transistors for this e-

Decimal Number System

yMost computers count in binary, which we can easily understand from the decimal so ingrained in us 35462

Decimal Number System

yMost computers count in binary, which we can easily understand from the decimal so ingrained in us

354622x100

Decimal Number System

yMost computers count in binary, which we can easily understand from the decimal so ingrained in us

354622x1006x101+

Decimal Number System

yMost computers count in binary, which we can easily understand from the decimal so ingrained in us

354622x1006x101+4x102+

Decimal Number System

yMost computers count in binary, which we can easily understand from the decimal so ingrained in us

354622x1006x101+4x102+5x103+

Decimal Number System

yMost computers count in binary, which we can easily understand from the decimal so ingrained in us

354622x1006x101+4x102+5x103+3x104+

Binary

yBinary is exactly the same, only instead of ten digits/states (0 to 9) we have just two, so the base becomes 2:

101100x201x21+1x22+0x23+1x24+

Binary

yBinary is exactly the same, only instead of ten digits/states (0 to 9) we have just two, so the base becomes 2:

10110b = 22d0x201x21+1x22+0x23+1x24+

Binary

yBinary is exactly the same, only instead of ten digits/states (0 to 9) we have just two, so the base becomes 2:

10110b = 22d0x201x21+1x22+0x23+1x24+

Most Signiificant

Bit (MSB)Least Signiificant

Bit (LSB)

Works for Fractional Numbers too...

35.4622x10-36x10-2+4x10-1+5x100+3x101+

Works for Fractional Numbers too...

10.110b = 2.75d0x2-31x2-2+1x2-1+0x20+1x21+35.4622x10-36x10-2+4x10-1+5x100+3x101+

Check

11.011b

Check

11.011b = 3.375d1x2-31x2-2+0x2-1+1x20+1x21+

Representable Numbers

yWith d decimal digits, we can represent 10d differentquotesdbs_dbs20.pdfusesText_26