Transcript

Applied physics III

Number systems: Arithmetic Operations

by Benson Mbuya1

Review of basic concepts of arithmetic

2

Addition and subtraction of binary numbers

3

Add the binary numbers 01010 and 10111

4

Subtract 111 from 10001

5

Hexadecimal Addition & Subtraction• Hexadecimal Addition

—Carry generated• Hexadecimal Subtraction

—Borrow weight 16

Hexadecimal AdditionCarry 1

2AC6 6+5=11d Bh + 92B5 C+B=23d 17h

BD7B A+2+1=13d Dh2+9=11d Bh

Hexadecimal SubtractionBorrow 111

92B5 21-6=15d Fh - 2AC6 26-C=14d Eh

67EF 17-A=7d 7h8-2=6d 6h

Octal Addition & Subtraction• Octal Addition

—Carry generated• Octal Subtraction

—Borrow weight 8

Octal AdditionCarry 1

7602 2+1=3d 3O + 5771 0+7=7d

7O 15573 6+7=13d 15O

1+7+5=13d 15O

Octal SubtractionBorrow 11

7602 2-1=1d 1O - 5771 8-7=1d 1O

1611 13-7=6d 6O6-5=1d 1O

Addition and subtraction of hexadecimal numbers

12

13

14

Representing negative numbers in a computer

• By convention the leftmost bit (or most significant bit) is considered the sign bit.

• A value of 0 in the sign bit indicates a positive number,

• whereas a 1 indicates a negative number.

15

examples

16

ONE’S COMPLEMENT

17

2’s Complement

18

references• Chapter 30, Teach yourself electronics, 3rd ed,

Stan Gibilisco.• Chapter 4, digital electronics demystified, Myke

Predko.• Chapter 18, Schaums outline: basic mathematics

with applications to science and technology, Kruglak, Moore.

• http://www.electronics.dit.ie/staff/tscarff/number_systems/number_systems.html

• http://active.tutsplus.com/tutorials/coding-concepts/number-systems-an-introduction-to-binary-hexadecimal-and-more/

• http://www.math.grin.edu/~rebelsky/Courses/152/97F/Readings/student-binary

• http://active.tutsplus.com/tutorials/coding-concepts/number-systems-an-introduction-to-binary-hexadecimal-and-more/

19

19

top related