Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 2 Number Systems

Similar presentations


Presentation on theme: "Lecture 2 Number Systems"— Presentation transcript:

1 Lecture 2 Number Systems
Introduction to Information Technology Lecture 2 Number Systems Dr. Ken Tsang 曾镜涛 Room E408 R9

2 Get slides from: The glossary and PDF version of the slides are here:

3 Outline Decimal Number System Binary Number System
Hexadecimal Number System Positional Numbering System Conversions Between Number Systems Conversions Between Power-of-Two Radices Bits, Bytes, and Words Basic Arithmetic Operations with Binary Numbers

4 Natural Numbers Natural numbers Zero and any number obtained by repeatedly adding one to it Negative Numbers A value less than 0, with a – sign Integers A natural number, a negative number, zero Rational Numbers An integer or the quotient of two integers We will only discuss the binary representation of non-negative integers

5 Decimal Number System A human usually has four fingers and a thumb on each hand, giving a total of ten digits over both hands 10 digits: 0,1,2,3,4,5,6,7,8,9 Also called base-10 number system, Or Hindu-Arabic, or Arabic system Counting in base-10 1,2,…,9,10,11,…,19,20,21,…,99,100,… Decimal number in expanded notation 234 = 2 * * * 1

6 Binary Number System Binary number system has only two digits
0, 1 Also called base-2 system Counting in binary system 0, 1, 10, 11, 100, 101, 110, 111, 1000,…. Binary number in expanded notation (1011)2 = 1*23 + 0*22 + 1*21 + 1*20 (1011)2 = 1* *4 + 1*2 + 1*1 = (11)10

7 Gottfried Leibniz ( ) Leibniz, the last universal genius, invented at least two things that are essential for the modern world: calculus, and the binary system. He invented the binary system around 1679, and published in This became the basis of virtually all modern computers.

8 Leibniz's Step Reckoner
Leibniz designed a machine to carry out multiplication, the 'Stepped Reckoner'. It can multiple number of up to 5 and 12 digits to give a 16 digit operand. The machine was later lost in an attic until 1879.

9 An ancient Chinese binary number system in Yi-Jing (易经)
Two symbols to represent 2 digits Zero: represented by a broken line One: represented by an unbroken line “—” yan 阳爻,“--” yin 阴爻。

10 Hexadecimal Hexadecimal number system has 16 digits
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F Also called base-16 system Counting in Hexadecimal 0,1,…,F,10,11,…,1F,20,…FF,100,… Hexadecimal number in expanded notation (FF)16 = 15* *160 = (255)10

11 Some Numbers to Remember

12 Positional Numbering System
The value of a digit in a number depends on: The digit itself The position of the digit within the number So 123 is different from 321 123: 1 hundred, 2 tens, and 3 units 321: 3 hundred, 2 tens, and 1 units

13 Base r Number System r symbols
Value is based on the sum of a power series in powers of r r is called the base, or radix

14 The Octal System (base 8)
Valid symbols: 0,1,2,3,4,5,6,7 = ? Questions: 2. How to count in Octal?

15 Why Binary? A computer is a Binary machine
It knows only ones and zeroes Easy to implement in electronic circuits Reliable Cheap

16 Bit and Byte BIT = Binary digIT, “0” or “1”
State of on or off ( high or low) of a computer circuit Kilo 1K = 210 = 1024 ≈ 103 Mega 1M = 220 = 1,048,576 ≈ 106 Giga 1G = 230 = 1,073,741,824 ≈ 109

17 Bit and Byte Byte is the basic unit of addressable memory
1 Byte = 8 Bits The right-most bit is called the LSB Least Significant Bit The Left-most bit is called the MSB Most Significant Bit

18 Why Hexadecimal? Hexadecimal is meaningful to humans, and easy to work with for a computer Compact A BYTE is composed of 8 bits One byte can thus be expressed by 2 digits in hexadecimal  EF b  EFh Simple to convert them to binary

19 Conversions Between Number Systems
Binary to Decimal

20 Conversions Between Number Systems
Hexadecimal to Decimal

21 Conversions Between Number Systems
Octal to Decimal (32)8 = (?)10 What’s wrong? (187)8 = 1*64 + 8*8 + 7*1

22 Conversions Between Number Systems
Decimal to Binary 32110 = ?2 remainder quotient 321 / 2 = 160 1 160 / 2 = 80 80 / 2 = 40 40 / 2 = 20 20 / 2 = 10 10 / 2 = 5 5 / = 2 2 / = 1 / = Reading the remainders from bottom to top, we have 32110 =

23 One More Example Convert to binary So, =

24 Conversions Between Number Systems
Decimal to Base r Same as Decimal to Binary Divide the number by r Record the quotient and remainder Divide the new quotient by r again ….. Repeat until the newest quotient is 0 Read the remainder from bottom to top

25 Exercises Convert 19910 to binary Convert 25510 to binary
Please show your steps of conversion clearly. Convert to binary Convert to binary Convert to hexadecimal Convert 2558 to decimal Convert to decimal

26 Conversions Between Power-of-2 Radices
Because 16 = 24, a group of 4 bits is easily recognized as a Hexadecimal digit And a group of 3 bits is easily recognized as one Octal digit To convert a Hex or Octal number to a binary number Represent each Hex or Octal digit with 4 or 3 bits in binary

27 Conversions Between Power-of-2 Radices
Convert a binary number to Hex or Oct number

28 Basic Arithmetic Operations with Binary Numbers
Rules for Binary Addition 1+1=0, with one to carry to the next place

29 Example

30 Example

31 Basic Arithmetic Operations with Binary Numbers
Rules for Binary Subtraction 1 - 0 = 1 1 - 1 = 0 0 - 0 = 0 0 - 1 = 1 … borrow 1 from the next most significant bit

32 Example minuend subtrahend difference

33 Two’s Complement Alternative way of doing Binary Subtraction
Invert the digits (of the subtrahend) Add 1 Add this to the minuend = Drop/Ignore the MSB

34 Why “Two’s Complement” works?
Suppose A = a 7-bit binary minuend B = a 7-bit binary subtrahend Want to calculate the difference C = A – B Rewrite C = A + ( – B ) +1 – D = – B = same as converting 0 to 1 and 1 to 0 in B (taking 2’s complement of each bit in B) So C = A + D

35 A “ten’s complement” scheme for decimal subtraction
A = 1234 a 4-digit decimal minuend B = 0567 a 4-digit decimal subtrahend Want to calculate the difference C = A – B Rewrite C = A + (9999 – B ) +1 – 10000 D = 9999 – B = 9432 (taking 10’s complement of each digit in B) So C = A + D

36 Binary Multiplication

37 Exercises = ? = ? × =?

38 Summary Decimal, Binary, and Hexadecimal Systems
Positional Numbering Systems Conversions Between Number Systems Conversions Between Power-of-Two Radices Bits and Bytes Basic Arithmetic Operations with Binary Numbers

39 Resolution: Scanner and digital camera
Scanner and digital camera manufacturers often refer to two different types of resolution when listing product specs: optical resolution and interpolated (or digital) resolution. The optical resolution is the true measurement of resolution that the output device can capture. Interpolated, or digital, resolution is acquired artificially. SPI (samples per inch) refers to scanning resolution.

40 Summary- In this lecture, we have discussed:
Digitizing images Pixels & resolution Some common graphic file formats Digital cameras & how to purchase one Dynamic range, white balance, and color temperature Graphic softwares

41 High dynamic range imaging (HDRI)
The intention of HDRI is to accurately represent the wide range of intensity levels found in real scenes ranging from direct sunlight to the deepest shadows. HDR images require a higher number of bits per color channel than traditional images, both because of the linear encoding and because they need to represent values from 10−4 to 108 (the range of visible luminance values) or more. 16-bit ("half precision") or 32-bit floating point numbers are often used to represent HDR pixels.


Download ppt "Lecture 2 Number Systems"

Similar presentations


Ads by Google